Skip to content

Commit

Permalink
Fix genesis not getting in default directory
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisszmundy committed Jul 31, 2024
1 parent b5cb737 commit 2017cc4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ src/test/resources/unit_tests/out/*
!src/test/resources/unit_tests/out/.gitkeep
kraftwerk-core/src/test/resources/unit_tests/out/*
qodana.yaml
kraftwerk-api/src/main/resources/kraftwerk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import fr.insee.kraftwerk.core.data.model.Mode;
import fr.insee.kraftwerk.core.data.model.SurveyUnitId;
import fr.insee.kraftwerk.core.data.model.SurveyUnitUpdateLatest;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpEntity;
Expand All @@ -24,6 +25,7 @@ public class GenesisClient {

private final RestTemplate restTemplate;

@Getter
private final ConfigProperties configProperties;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public class ConfigProperties {
private String genesisUrl;

@Value("${fr.insee.postcollecte.files}")
private String specDirectory;
private String defaultDirectory;

@PostConstruct
public void setTempDirectory() {
System.setProperty("java.io.tmpdir", Paths.get(specDirectory,"temp","currentExecution").toString());
System.setProperty("java.io.tmpdir", Paths.get(defaultDirectory,"temp","currentExecution").toString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public MainProcessingGenesis(ConfigProperties config, FileUtilsInterface fileUti

public void init(String idCampaign) throws KraftwerkException {
log.info("Kraftwerk main service started for campaign: " + idCampaign);
this.controlInputSequenceGenesis = new ControlInputSequenceGenesis("", fileUtilsInterface);
this.controlInputSequenceGenesis = new ControlInputSequenceGenesis(client.getConfigProperties().getDefaultDirectory(), fileUtilsInterface);
this.executionDateTime = LocalDateTime.now();
inDirectory = controlInputSequenceGenesis.getInDirectory(idCampaign);
//First we check the modes present in database for the given questionnaire
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public ResponseEntity<String> healthcheck() {
status,
projectVersion,
client.pingGenesis().split("\n")[0],
configProperties.getSpecDirectory(),
configProperties.getDefaultDirectory(),
fileStorageStatus
));
}

private String fileStorageExists() {
try{
Files.exists(Paths.get(configProperties.getSpecDirectory()));
Files.exists(Paths.get(configProperties.getDefaultDirectory()));
}catch (Exception e){
return "Disconnected " +e.getMessage();
}
Expand Down

0 comments on commit 2017cc4

Please sign in to comment.