Skip to content

Commit 09e7d77

Browse files
authored
Get status of DS and DSA, return string not enum like other statuses (#853)
--------- Signed-off-by: Thang PHAM <[email protected]>
1 parent afa13f8 commit 09e7d77

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/org/gridsuite/study/server/controller/StudyController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,11 +1981,11 @@ public ResponseEntity<List<TimelineEventInfos>> getDynamicSimulationTimelineResu
19811981
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The status of dynamic simulation result"),
19821982
@ApiResponse(responseCode = "204", description = "No dynamic simulation status"),
19831983
@ApiResponse(responseCode = "404", description = "The dynamic simulation has not been found")})
1984-
public ResponseEntity<DynamicSimulationStatus> getDynamicSimulationStatus(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid,
1984+
public ResponseEntity<String> getDynamicSimulationStatus(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid,
19851985
@Parameter(description = "rootNetworkUuid") @PathVariable("rootNetworkUuid") UUID rootNetworkUuid,
19861986
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) {
19871987
DynamicSimulationStatus result = rootNetworkNodeInfoService.getDynamicSimulationStatus(nodeUuid, rootNetworkUuid);
1988-
return result != null ? ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(result) :
1988+
return result != null ? ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(result.name()) :
19891989
ResponseEntity.noContent().build();
19901990
}
19911991

@@ -2031,11 +2031,11 @@ public ResponseEntity<Void> runDynamicSecurityAnalysis(@Parameter(description =
20312031
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The status of dynamic security analysis result"),
20322032
@ApiResponse(responseCode = "204", description = "No dynamic security analysis status"),
20332033
@ApiResponse(responseCode = "404", description = "The dynamic security analysis has not been found")})
2034-
public ResponseEntity<DynamicSecurityAnalysisStatus> getDynamicSecurityAnalysisStatus(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid,
2034+
public ResponseEntity<String> getDynamicSecurityAnalysisStatus(@Parameter(description = "study UUID") @PathVariable("studyUuid") UUID studyUuid,
20352035
@Parameter(description = "root network id") @PathVariable("rootNetworkUuid") UUID rootNetworkUuid,
20362036
@Parameter(description = "nodeUuid") @PathVariable("nodeUuid") UUID nodeUuid) {
20372037
DynamicSecurityAnalysisStatus result = rootNetworkNodeInfoService.getDynamicSecurityAnalysisStatus(nodeUuid, rootNetworkUuid);
2038-
return result != null ? ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(result) :
2038+
return result != null ? ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(result.name()) :
20392039
ResponseEntity.noContent().build();
20402040
}
20412041

src/test/java/org/gridsuite/study/server/StudyControllerDynamicSecurityAnalysisTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void testGetDynamicSecurityAnalysisStatus() throws Exception {
444444
STUDY_UUID, ROOT_NETWORK_UUID, NODE_UUID)
445445
.header(HEADER_USER_ID_NAME, HEADER_USER_ID_VALUE))
446446
.andExpect(status().isOk()).andReturn();
447-
DynamicSecurityAnalysisStatus statusResult = objectMapper.readValue(result.getResponse().getContentAsString(), DynamicSecurityAnalysisStatus.class);
447+
DynamicSecurityAnalysisStatus statusResult = DynamicSecurityAnalysisStatus.valueOf(result.getResponse().getContentAsString());
448448

449449
// --- check result --- //
450450
DynamicSecurityAnalysisStatus statusExpected = DynamicSecurityAnalysisStatus.FAILED;

src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void testGetDynamicSimulationStatus() throws Exception {
606606
STUDY_UUID, ROOT_NETWORK_UUID, NODE_UUID)
607607
.header(HEADER_USER_ID_NAME, HEADER_USER_ID_VALUE))
608608
.andExpect(status().isOk()).andReturn();
609-
DynamicSimulationStatus statusResult = objectMapper.readValue(result.getResponse().getContentAsString(), DynamicSimulationStatus.class);
609+
DynamicSimulationStatus statusResult = DynamicSimulationStatus.valueOf(result.getResponse().getContentAsString());
610610

611611
// --- check result --- //
612612
DynamicSimulationStatus statusExpected = DynamicSimulationStatus.DIVERGED;

0 commit comments

Comments
 (0)