Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
b327da3
Merge branch 'java25' into devTests
alexisszmundy Feb 5, 2026
00f75a8
refactor: moved integration tests into dedicated package
alexisszmundy Feb 5, 2026
ad30d46
test: contextualVariableController unit test
alexisszmundy Feb 5, 2026
23e7802
test: controllers unit tests
alexisszmundy Feb 6, 2026
16bc8fd
test: rest of controller tests
alexisszmundy Feb 9, 2026
11aa6d0
test: context service unit tests + deprecations
alexisszmundy Feb 9, 2026
2b2abf8
test: contextual variable service unit tests
alexisszmundy Feb 9, 2026
44ca639
test: some services unit tests
alexisszmundy Feb 10, 2026
608bda8
refactor: use mockito annotations
alexisszmundy Feb 10, 2026
00faa8b
chore: imports
alexisszmundy Feb 11, 2026
89036c3
wip: process lunatic raw data test
alexisszmundy Feb 12, 2026
df1cebf
Merge branch 'main' into devTests
alexisszmundy Feb 19, 2026
4f804ce
test: lunatic json raw data unit test
alexisszmundy Feb 19, 2026
edaddc5
test: services tests
alexisszmundy Feb 20, 2026
0b94aa3
test: save edited no campaignId new condition
alexisszmundy Feb 24, 2026
86eaa67
fix: don't use campaignId
alexisszmundy Feb 24, 2026
34b9686
Merge branch 'main' into devTests
alexisszmundy Feb 24, 2026
789c7b4
Merge branch 'devResponseStates' into devTests
alexisszmundy Feb 26, 2026
4f95d7e
Merge branch 'devResponseStates' into devTests
alexisszmundy Feb 26, 2026
5de6b96
Merge branch 'main' into devTests
alexisszmundy Mar 4, 2026
ace5362
Merge branch 'main' into devTests
alexisszmundy Mar 5, 2026
c273dbb
fix: test fixes after merge
alexisszmundy Mar 5, 2026
7319ebd
test: more models tests
alexisszmundy Mar 5, 2026
9f5438e
test: cache, context and contextual adapters
alexisszmundy Mar 5, 2026
bedda4a
test: adapter tests
alexisszmundy Mar 5, 2026
28e06af
test: surveyunitmodelmongoadapter test
alexisszmundy Mar 6, 2026
840c351
fix: use deep stubs + rename files
alexisszmundy Mar 6, 2026
013eac1
fix: put back normal stubs, problem is local
alexisszmundy Mar 6, 2026
feddc14
fix: use jacoco
alexisszmundy Mar 6, 2026
cb019be
test: NoDataException
alexisszmundy Mar 6, 2026
86b0338
test: ScheduleDocument & RawResponseInputRepository
alexisszmundy Mar 6, 2026
9888967
test: OidcServiceTest
alexisszmundy Mar 6, 2026
0881302
test: FileUtilsTest
alexisszmundy Mar 6, 2026
f0962b8
test: controller adapter tests
alexisszmundy Mar 6, 2026
4705367
chore: remove old tests
alexisszmundy Mar 6, 2026
9bc6d11
fix: put back stubs for cucumber
alexisszmundy Mar 6, 2026
ce9b05c
test: health check controller test
alexisszmundy Mar 6, 2026
f4a8c13
test: raw response controller reworked
alexisszmundy Mar 6, 2026
45d76e7
chore: disabled unused mode V2 endpoints
alexisszmundy Mar 9, 2026
223751a
fix: mode path variable
alexisszmundy Mar 9, 2026
c80efd6
Merge branch 'main' into devTests
alexisszmundy Mar 9, 2026
38697e8
refactor: renamed contextualVariableControllerTest
alexisszmundy Mar 9, 2026
6bf04c7
refactor: moved ControllerAccessTest
alexisszmundy Mar 10, 2026
bd19532
test: removed already tested access tests
alexisszmundy Mar 10, 2026
c39d703
test: updated filiere model json body for tests
alexisszmundy Mar 10, 2026
99abc8e
chore: remove unused
alexisszmundy Mar 10, 2026
beafc6d
refactor: renamed controller access test
alexisszmundy Mar 10, 2026
b7832d7
test: converted raw data saving cucumber into IT
alexisszmundy Mar 13, 2026
059184f
Merge branch 'main' into devTests
alexisszmundy Mar 13, 2026
49181b9
test: process filiere model raw data IT wip
alexisszmundy Mar 13, 2026
0ad7630
test: process raw data integration tests
alexisszmundy Mar 20, 2026
0a2ed10
Merge branch 'main' into devTests
alexisszmundy Mar 20, 2026
e5e5e96
refactor: abstract in ControllerAccess IT
alexisszmundy Mar 20, 2026
ff0def7
refactor: remove useless autowired
alexisszmundy Mar 20, 2026
094b144
test: save context
alexisszmundy Mar 20, 2026
aae705d
test: save lunatic model wip
alexisszmundy Mar 20, 2026
0cc4335
test: save lunatic parameterized
alexisszmundy Mar 23, 2026
9c32d03
test: save lunatic model invalid syntax
alexisszmundy Mar 23, 2026
432cbd5
test: get lunatic model and questionnaire IT
alexisszmundy Mar 23, 2026
5f17bb6
Update UtilsControllerTest.java
alexisszmundy Mar 23, 2026
44038a6
refactor: removed compareMaps method
alexisszmundy Mar 23, 2026
0f77597
Merge branch 'main' into devTests
alexisszmundy Mar 23, 2026
b3fb103
test: get simplified response wip
alexisszmundy Mar 23, 2026
b6320fb
fix: 404 when no simplified found
alexisszmundy Mar 25, 2026
dc8fc2c
test: get latest states IT
alexisszmundy Mar 25, 2026
44c36ee
chore: removed deprecated cucumber features
alexisszmundy Mar 25, 2026
8680358
test: delete schedules IT
alexisszmundy Mar 25, 2026
66ee130
chore: remove cucumber
alexisszmundy Mar 25, 2026
ebc5894
chore: remove unused resources files
alexisszmundy Mar 25, 2026
7fee2aa
Merge branch 'main' into devTests
alexisszmundy Mar 26, 2026
1191b8d
Update Tests GENESIS.run.xml
alexisszmundy Mar 26, 2026
70d0986
chore: remove partitionId from context
alexisszmundy Mar 26, 2026
78b48b8
chore: remove campaignId except in lunatic json raw
alexisszmundy Mar 27, 2026
dd340e3
Merge branch 'main' into removePartitionId
alexisszmundy Mar 27, 2026
842e59c
fix: check updateProcessDate IT
alexisszmundy Mar 27, 2026
e5c0308
Merge branch 'devTests' into removePartitionId
alexisszmundy Mar 27, 2026
67f2a24
Merge branch 'removePartitionId' into removeCampaignId
alexisszmundy Mar 27, 2026
26c8a40
Merge branch 'main' into devTests
alexisszmundy Mar 27, 2026
dfa6683
fix: disabled delete expired schedules IT
alexisszmundy Mar 27, 2026
5970c24
Merge branch 'devTests' into removePartitionId
alexisszmundy Mar 27, 2026
d1b66bb
Merge branch 'removePartitionId' into removeCampaignId
alexisszmundy Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Unit tests GENESIS" type="JUnit" factoryName="JUnit">
<configuration default="false" name="Tests GENESIS" type="JUnit" factoryName="JUnit">
<module name="genesis-api" />
<extension name="coverage" runner="jacoco" />
<option name="PACKAGE_NAME" value="fr.insee.genesis" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
Expand Down
66 changes: 36 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<java.version>25</java.version>
<springdoc.version>2.8.16</springdoc.version>
<mapstruct.version>1.6.3</mapstruct.version>
<cucumber.version>7.34.2</cucumber.version>
<junit-jupiter.version>5.13.4</junit-jupiter.version>
<jackson-bom.version>2.21.1</jackson-bom.version>

Expand Down Expand Up @@ -125,32 +124,6 @@
<version>${mapstruct.version}</version>
</dependency>

<!-- Cucumber -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.junit.vintage</groupId>
Expand Down Expand Up @@ -263,16 +236,49 @@
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<printSummary>true</printSummary>
<includes>
<include>**/*FT.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
<parallel>methods</parallel>
<threadCount>4</threadCount>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</plugin>
<plugin>
Expand All @@ -281,10 +287,10 @@
<version>${pitest.version}</version>
<configuration>
<targetClasses>
<param>fr.insee.kraftwerk.*</param>
<param>fr.insee.genesis.*</param>
</targetClasses>
<targetTests>
<param>fr.insee.kraftwerk.*</param>
<param>fr.insee.genesis.*</param>
</targetTests>
<mutators>
<mutator>STRONGER</mutator>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/fr/insee/genesis/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class Constants {
public static final String SCHEDULE_ARCHIVE_FOLDER_NAME = "genesis_deleted_schedules";
public static final String SAME_AXIS_VALUE = "0";

public static final String VARIABLE_STATE_DTO_DATE_FORMAT = "dd/MM/yyyy HH:mm:ss.SSS";


// XML sequential reading parameters
public static final int MAX_FILE_SIZE_UNTIL_SEQUENTIAL = 200; // In megabytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class LunaticJsonAdapter {
public SurveyUnitModel convert(LunaticJsonSurveyUnit su){
return SurveyUnitModel.builder()
.collectionInstrumentId(su.getQuestionnaireId())
.campaignId("")
.interrogationId(su.getInterrogationId())
.state(DataState.COLLECTED)
.mode(Mode.WEB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@
* @param dataState state of the SurveyUnitModel to generate
* @return SurveyUnitModel with a specific state
*/
private static SurveyUnitModel getStateDataFromSurveyUnit(LunaticXmlSurveyUnit su, VariablesMap variablesMap, String campaignId, DataState dataState, Mode mode) {

Check warning on line 70 in src/main/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapter.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused method parameter "campaignId".

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ0vd2bZHCNUh2gxL_8h&open=AZ0vd2bZHCNUh2gxL_8h&pullRequest=437
SurveyUnitModel surveyUnitModel = SurveyUnitModel.builder()
.collectionInstrumentId(su.getQuestionnaireModelId().toUpperCase())
.campaignId(campaignId)
.interrogationId(su.getId())
.state(dataState)
.mode(mode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
@Builder
@Data
public class SurveyUnitInputDto {
private String questionnaireId;
private String interrogationId;
private String campaignId;
private Mode mode;
private String questionnaireId;
private List<VariableInputDto> collectedVariables;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
public class SurveyUnitSimplifiedDto {

private String collectionInstrumentId;
/**
* @deprecated We will not receive this piece of information anymore
*/
@Deprecated(forRemoval = true, since = "2026-01-01")
private String campaignId;
private String interrogationId;
private String usualSurveyUnitId;
private Mode mode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.insee.genesis.controller.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import fr.insee.genesis.Constants;
import fr.insee.genesis.domain.model.surveyunit.DataState;
import lombok.Builder;
import lombok.Data;
Expand All @@ -14,6 +15,6 @@ public class VariableStateDto {
private boolean active;
private Object value;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy HH:mm:ss.SSS")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Constants.VARIABLE_STATE_DTO_DATE_FORMAT)
private LocalDateTime date;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import lombok.Builder;

@Builder
public record LunaticJsonRawDataUnprocessedDto(String campaignId, String questionnaireId, String interrogationId){}
public record LunaticJsonRawDataUnprocessedDto(String questionnaireId, String interrogationId){}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CombinedRawDataController {
@Operation(summary = "Retrieve combined raw responses and Lunatic raw data for a given interrogationId")
@GetMapping
@PreAuthorize("hasAnyRole('ADMIN', 'USER_PLATINE')")
public ResponseEntity<CombinedRawDataDto> getCombinetRawData(
public ResponseEntity<CombinedRawDataDto> getCombinedRawData(
@RequestParam(INTERROGATION_ID) String interrogationId
){
CombinedRawDataDto data = combinedRawDataService.getCombinedRawDataByInterrogationId(interrogationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -34,23 +33,6 @@ public class DataProcessingContextController {
private DataProcessingContextApiPort dataProcessingContextApiPort;
private final FileUtils fileUtils;

@Deprecated(forRemoval = true)
@Operation(summary = "Create or update a data processing context")
@PutMapping(path = "/context/review")
@PreAuthorize("hasAnyRole('USER_PLATINE', 'USER_BACK_OFFICE', 'SCHEDULER')")
public ResponseEntity<Object> saveContext(
@Parameter(description = "Identifier of the partition", required = true) @RequestParam("partitionId") String partitionId,
@Parameter(description = "Allow reviewing") @RequestParam(value = "withReview", defaultValue = "false") Boolean withReview
){
try {
withReview = withReview != null && withReview; //False if null
dataProcessingContextApiPort.saveContext(partitionId, withReview);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
}
return ResponseEntity.ok().build();
}

@Operation(summary = "Create or update a data processing context")
@PutMapping(path = "/contexts/{collectionInstrumentId}/review")
@PreAuthorize("hasAnyRole('USER_PLATINE', 'USER_BACK_OFFICE', 'SCHEDULER')")
Expand Down Expand Up @@ -82,67 +64,6 @@ public ResponseEntity<Object> getReviewIndicatorByCollectionInstrumentId(
}
}

@Deprecated(forRemoval = true)
@Operation(summary = "Returns partition review indicator")
@GetMapping(path = "/context/review")
@PreAuthorize("hasAnyRole('USER_BACK_OFFICE','SCHEDULER','USER_PLATINE')")
public ResponseEntity<Object> getReviewIndicator(
@Parameter(description = "Identifier of the partition", required = true) @RequestParam("partitionId") String partitionId
){
try {
boolean withReview = dataProcessingContextApiPort.getReviewByPartitionId(partitionId);
return ResponseEntity.ok(withReview);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
}
}

@Deprecated(forRemoval = true)
@Operation(summary = "Schedule a Kraftwerk execution")
@PutMapping(path = "/context/schedules")
@PreAuthorize("hasRole('USER_KRAFTWERK')")
public ResponseEntity<Object> saveSchedule(
@Parameter(description = "Partition identifier to call Kraftwerk on") @RequestParam("partitionId") String partitionId,
@Parameter(description = "Kraftwerk endpoint") @RequestParam(value = "serviceTocall", defaultValue = Constants.KRAFTWERK_MAIN_ENDPOINT) ServiceToCall serviceToCall,
@Parameter(description = "Frequency in Spring cron format (6 inputs, go to https://crontab.cronhub.io/ for generator) \n Example : 0 0 6 * * *") @RequestParam("frequency") String frequency,
@Parameter(description = "Schedule effective date and time", example = "2024-01-01T12:00:00") @RequestParam("scheduleBeginDate") LocalDateTime scheduleBeginDate,
@Parameter(description = "Schedule end date and time", example = "2024-01-01T12:00:00") @RequestParam("scheduleEndDate") LocalDateTime scheduleEndDate,
@Parameter(description = "Encrypt after process ? Ignore next parameters if false") @RequestParam(value =
"useEncryption",
defaultValue = "false") boolean useEncryption,
@Parameter(description = "(Encryption) vault path") @RequestParam(value = "encryptionVaultPath", defaultValue = "") String encryptionVaultPath,
@Parameter(description = "(Encryption) output folder") @RequestParam(value = "encryptionOutputFolder",
defaultValue = "") String encryptionOutputFolder,
@Parameter(description = "(Encryption) Use signature system") @RequestParam(value = "useSignature", defaultValue = "false") boolean useSignature
) {
try {
//Check frequency
if(!CronExpression.isValidExpression(frequency)) {
log.warn("Returned error for wrong frequency : {}", frequency);
throw new GenesisException(400, "Wrong frequency syntax");
}

TrustParameters trustParameters = null;
if(useEncryption) {
trustParameters = new TrustParameters(
fileUtils.getKraftwerkOutFolder(partitionId),
encryptionOutputFolder,
encryptionVaultPath,
useSignature
);
}
dataProcessingContextApiPort.saveKraftwerkExecutionSchedule(
partitionId,
serviceToCall == null ? ServiceToCall.MAIN : serviceToCall,
frequency,
scheduleBeginDate, scheduleEndDate, trustParameters
);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
}
return ResponseEntity.ok().build();
}

// Should be refactored to make it restfull
@Operation(summary = "Schedule a Kraftwerk execution using the collection instrument")
@PutMapping(path = "/contexts/schedules")
Expand Down Expand Up @@ -181,7 +102,9 @@ public ResponseEntity<Object> saveScheduleWithCollectionInstrumentId(
collectionInstrumentId,
serviceToCall == null ? ServiceToCall.MAIN : serviceToCall,
frequency,
scheduleBeginDate, scheduleEndDate, trustParameters
scheduleBeginDate,
scheduleEndDate,
trustParameters
);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
Expand Down Expand Up @@ -215,24 +138,6 @@ public ResponseEntity<Object> getAllSchedulesV2() {
return ResponseEntity.ok(surveyScheduleDocumentModels);
}


@Deprecated(forRemoval = true)
@Operation(summary = "Set last execution date of a partition with new date or nothing")
@PostMapping(path = "/context/schedules/lastExecutionDate")
@PreAuthorize("hasRole('SCHEDULER')")
public ResponseEntity<Object> setSurveyLastExecution(
@Parameter(description = "Survey name to call Kraftwerk on") @RequestBody String partitionId,
@Parameter(description = "Date to save as last execution date", example = "2024-01-01T12:00:00") @RequestParam("newDate") LocalDateTime newDate
) {
try {
dataProcessingContextApiPort.updateLastExecutionDate(partitionId, newDate);
log.info("{} last execution updated at {} !", partitionId, newDate);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
}
return ResponseEntity.ok().build();
}

@Operation(summary = "Update the date of the last extraction of data corresponding to a collection instrument")
@PutMapping(path = "/contexts/{collectionInstrumentId}/lastExecutionDate")
@PreAuthorize("hasRole('SCHEDULER')")
Expand All @@ -249,22 +154,6 @@ public ResponseEntity<Object> setSurveyLastExecutionByCollectionInstrumentId(
return ResponseEntity.ok().build();
}

@Deprecated(forRemoval = true)
@Operation(summary = "Delete the Kraftwerk execution schedules of a partition")
@DeleteMapping(path = "/context/schedules")
@PreAuthorize("hasRole('USER_KRAFTWERK')")
public ResponseEntity<Object> deleteSchedules(
@Parameter(description = "Survey name of the schedule(s) to delete") @RequestParam("partitionId") String partitionId
){
try {
dataProcessingContextApiPort.deleteSchedules(partitionId);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
}
log.info("Schedule deleted for survey {}", partitionId);
return ResponseEntity.ok().build();
}

@Operation(summary = "Delete the Kraftwerk execution schedules of a collection instrument id")
@DeleteMapping(path = "/context/{collectionInstrumentId}/schedules")
@PreAuthorize("hasRole('USER_KRAFTWERK')")
Expand Down
Loading
Loading