From e92d51031ad441e2088ec3893f8a7242aef8b71e Mon Sep 17 00:00:00 2001 From: Tristan Chuine Date: Mon, 10 Jun 2024 19:51:22 +0200 Subject: [PATCH] Move to PR #586 --- .../org/gridsuite/study/server/StudyTest.java | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/src/test/java/org/gridsuite/study/server/StudyTest.java b/src/test/java/org/gridsuite/study/server/StudyTest.java index be835d405..e52296c38 100644 --- a/src/test/java/org/gridsuite/study/server/StudyTest.java +++ b/src/test/java/org/gridsuite/study/server/StudyTest.java @@ -265,8 +265,8 @@ public class StudyTest { private NetworkStoreService networkStoreService; //output destinations - private static final String STUDY_UPDATE_DESTINATION = "study.update"; - private static final String ELEMENT_UPDATE_DESTINATION = "element.update"; + private final String studyUpdateDestination = "study.update"; + private final String elementUpdateDestination = "element.update"; private boolean indexed = false; @@ -841,7 +841,7 @@ public void test() throws Exception { modificationNode1.setNodeBuildStatus(NodeBuildStatus.from(BuildStatus.BUILT)); networkModificationTreeService.updateNode(studyNameUserIdUuid, modificationNode1, userId); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); checkElementUpdatedMessageSent(studyNameUserIdUuid, userId); mockMvc.perform(get("/v1/studies/{studyUuid}/nodes/{nodeUuid}/export-network/{format}", studyNameUserIdUuid, modificationNode1Uuid, "XIIDM")) @@ -1019,7 +1019,7 @@ private NetworkModificationNode createNetworkModificationNode(UUID studyUuid, UU mockMvc.perform(post("/v1/studies/{studyUuid}/tree/nodes/{id}", studyUuid, parentNodeUuid).content(mnBodyJson).contentType(MediaType.APPLICATION_JSON).header(USER_ID_HEADER, userId)) .andExpect(status().isOk()); checkElementUpdatedMessageSent(studyUuid, userId); - var mess = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + var mess = output.receive(TIMEOUT, studyUpdateDestination); assertNotNull(mess); modificationNode.setId(UUID.fromString(String.valueOf(mess.getHeaders().get(NotificationService.HEADER_NEW_NODE)))); assertEquals(InsertMode.CHILD.name(), mess.getHeaders().get(NotificationService.HEADER_INSERT_MODE)); @@ -1118,7 +1118,7 @@ private void assertStudyCreation(UUID studyUuid, String userId, String... errorM assertTrue(studyRepository.findById(studyUuid).isPresent()); // assert that the broker message has been sent a study creation request message - Message message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(message.getPayload())); MessageHeaders headers = message.getHeaders(); @@ -1126,10 +1126,10 @@ private void assertStudyCreation(UUID studyUuid, String userId, String... errorM assertEquals(studyUuid, headers.get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.UPDATE_TYPE_STUDIES, headers.get(HEADER_UPDATE_TYPE)); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); // message for first modification node creation + output.receive(TIMEOUT, studyUpdateDestination); // message for first modification node creation // assert that the broker message has been sent a study creation message for creation - message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + message = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(message.getPayload())); headers = message.getHeaders(); assertEquals(userId, headers.get(HEADER_USER_ID)); @@ -1241,13 +1241,13 @@ public void testGetStudyCreationRequests() throws Exception { countDownLatch.countDown(); // drop the broker message for study creation request (creation) - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); // drop the broker message for study creation - output.receive(TIMEOUT * 3, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT * 3, studyUpdateDestination); // drop the broker message for node creation - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); // drop the broker message for study creation request (deletion) - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); mvcResult = mockMvc.perform(get("/v1/study_creation_requests").header(USER_ID_HEADER, "userId")).andExpectAll( status().isOk(), @@ -1293,13 +1293,13 @@ public void testGetStudyCreationRequests() throws Exception { countDownLatch.countDown(); // drop the broker message for study creation request (creation) - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); // drop the broker message for study creation output.receive(TIMEOUT * 3); // drop the broker message for node creation - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); // drop the broker message for study creation request (deletion) - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); mvcResult = mockMvc.perform(get("/v1/study_creation_requests") .header(USER_ID_HEADER, "userId")).andExpectAll( @@ -1331,7 +1331,7 @@ public void testGetStudyCreationRequests() throws Exception { private void checkUpdateModelStatusMessagesReceived(UUID studyUuid, UUID nodeUuid, String updateType) { // assert that the broker message has been sent for updating model status - Message messageStatus = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message messageStatus = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(messageStatus.getPayload())); MessageHeaders headersStatus = messageStatus.getHeaders(); assertEquals(studyUuid, headersStatus.get(NotificationService.HEADER_STUDY_UUID)); @@ -1353,7 +1353,7 @@ private void checkUpdateModelsStatusMessagesReceived(UUID studyUuid, UUID nodeUu } private void checkNodeBuildStatusUpdatedMessageReceived(UUID studyUuid, List nodesUuids) { - Message messageStatus = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message messageStatus = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(messageStatus.getPayload())); MessageHeaders headersStatus = messageStatus.getHeaders(); assertEquals(studyUuid, headersStatus.get(NotificationService.HEADER_STUDY_UUID)); @@ -1363,7 +1363,7 @@ private void checkNodeBuildStatusUpdatedMessageReceived(UUID studyUuid, List messageStudyUpdate = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message messageStudyUpdate = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(messageStudyUpdate.getPayload())); MessageHeaders headersStudyUpdate = messageStudyUpdate.getHeaders(); assertEquals(studyNameUserIdUuid, headersStudyUpdate.get(NotificationService.HEADER_STUDY_UUID)); @@ -1373,7 +1373,7 @@ private void checkEquipmentCreatingMessagesReceived(UUID studyNameUserIdUuid, UU private void checkEquipmentUpdatingFinishedMessagesReceived(UUID studyNameUserIdUuid, UUID nodeUuid) { // assert that the broker message has been sent for updating study type - Message messageStudyUpdate = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message messageStudyUpdate = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(messageStudyUpdate.getPayload())); MessageHeaders headersStudyUpdate = messageStudyUpdate.getHeaders(); assertEquals(studyNameUserIdUuid, headersStudyUpdate.get(NotificationService.HEADER_STUDY_UUID)); @@ -1383,7 +1383,7 @@ private void checkEquipmentUpdatingFinishedMessagesReceived(UUID studyNameUserId private void checkStudyMetadataUpdatedMessagesReceived() { // assert that the broker message has been sent for updating study type - Message messageStudyUpdate = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message messageStudyUpdate = output.receive(TIMEOUT, studyUpdateDestination); assertEquals("", new String(messageStudyUpdate.getPayload())); MessageHeaders headersStudyUpdate = messageStudyUpdate.getHeaders(); assertEquals(NotificationService.UPDATE_TYPE_STUDY_METADATA_UPDATED, headersStudyUpdate.get(NotificationService.HEADER_UPDATE_TYPE)); @@ -1458,7 +1458,7 @@ private void testDuplicateStudy(UUID study1Uuid) throws Exception { node2.setVoltageInitResultUuid(UUID.randomUUID()); node2.setSecurityAnalysisResultUuid(UUID.randomUUID()); networkModificationTreeService.updateNode(study1Uuid, node2, userId); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); checkElementUpdatedMessageSent(study1Uuid, userId); // duplicate the study @@ -1510,7 +1510,7 @@ public void testDuplicateStudyWithErrorDuringCaseDuplication() throws Exception .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); String duplicatedStudyUuid = mapper.readValue(response, String.class); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); assertNull(studyRepository.findById(UUID.fromString(duplicatedStudyUuid)).orElse(null)); } @@ -1522,20 +1522,20 @@ private StudyEntity duplicateStudy(UUID studyUuid) throws Exception { .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); String newUuid = mapper.readValue(response, String.class); StudyEntity sourceStudy = studyRepository.findById(studyUuid).orElseThrow(); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); - Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); + Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(newUuid, indexationStatusMessageOnGoing.getHeaders().get(NotificationService.HEADER_STUDY_UUID).toString()); assertEquals(NotificationService.UPDATE_TYPE_INDEXATION_STATUS, indexationStatusMessageOnGoing.getHeaders().get(HEADER_UPDATE_TYPE)); assertEquals(StudyIndexationStatus.INDEXING_ONGOING.name(), indexationStatusMessageOnGoing.getHeaders().get(NotificationService.HEADER_INDEXATION_STATUS)); - Message indexationStatusMessageDone = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message indexationStatusMessageDone = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(newUuid, indexationStatusMessageDone.getHeaders().get(NotificationService.HEADER_STUDY_UUID).toString()); assertEquals(NotificationService.UPDATE_TYPE_INDEXATION_STATUS, indexationStatusMessageDone.getHeaders().get(HEADER_UPDATE_TYPE)); assertEquals(StudyIndexationStatus.INDEXED.name(), indexationStatusMessageDone.getHeaders().get(NotificationService.HEADER_INDEXATION_STATUS)); - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); StudyEntity duplicatedStudy = studyRepository.findById(UUID.fromString(newUuid)).orElse(null); assertNotNull(duplicatedStudy); @@ -1664,7 +1664,7 @@ public void testCutAndPasteNode() throws Exception { node2.setLoadFlowResultUuid(UUID.randomUUID()); node2.setSecurityAnalysisResultUuid(UUID.randomUUID()); networkModificationTreeService.updateNode(study1Uuid, node2, userId); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); checkElementUpdatedMessageSent(study1Uuid, userId); // node2 should not have any child @@ -1902,21 +1902,21 @@ public void testCutAndPasteSubtree() throws Exception { checkNodeBuildStatusUpdatedMessageReceived(study1Uuid, List.of(emptyNode.getId(), emptyNodeChild.getId())); //loadflow_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //securityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //sensitivityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //nonEvacuatedEnergy_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //shortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //oneBusShortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //dynamicSimulation_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //voltageInit_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); checkSubtreeMovedMessageSent(study1Uuid, emptyNode.getId(), node1.getId()); checkElementUpdatedMessageSent(study1Uuid, userId); @@ -1983,7 +1983,7 @@ public void testDuplicateNode() throws Exception { node2.setLoadFlowResultUuid(UUID.randomUUID()); node2.setSecurityAnalysisResultUuid(UUID.randomUUID()); networkModificationTreeService.updateNode(study1Uuid, node2, userId); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); checkElementUpdatedMessageSent(study1Uuid, userId); //node2 should not have any child @@ -2109,7 +2109,7 @@ public void testDuplicateSubtree() throws Exception { node2.setLoadFlowResultUuid(UUID.randomUUID()); node2.setSecurityAnalysisResultUuid(UUID.randomUUID()); networkModificationTreeService.updateNode(study1Uuid, node2, userId); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + output.receive(TIMEOUT, studyUpdateDestination); checkElementUpdatedMessageSent(study1Uuid, userId); //node 4 should not have any children @@ -2270,7 +2270,7 @@ private void cutAndPasteNode(UUID studyUuid, NetworkModificationNode nodeToCopy, * moving node */ //nodeMoved - Message message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.NODE_MOVED, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); assertEquals(nodeToCopy.getId(), message.getHeaders().get(NotificationService.HEADER_MOVED_NODE)); @@ -2282,52 +2282,52 @@ private void cutAndPasteNode(UUID studyUuid, NetworkModificationNode nodeToCopy, */ IntStream.rangeClosed(1, childCount).forEach(i -> { //nodeUpdated - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //loadflow_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //securityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //sensitivityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //nonEvacuatedEnergy_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //shortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //oneBusShortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //dynamicSimulation_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //voltageInit_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); }); /* * invalidating new children */ //nodeUpdated - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //loadflow_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //securityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //sensitivityAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //sensitivityAnalysisonEvacuated_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //shortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //oneBusShortCircuitAnalysis_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //dynamicSimulation_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); //voltageInit_status - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); } else { /* * Invalidating moved node */ //nodeUpdated - assertNotNull(output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, studyUpdateDestination)); } } @@ -2355,9 +2355,9 @@ private UUID duplicateNode(UUID sourceStudyUuid, UUID targetStudyUuid, NetworkMo .filter(Predicate.not(allNodesBeforeDuplication::contains)).toList(); assertEquals(1, nodesAfterDuplication.size()); - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); // nodeCreated + output.receive(TIMEOUT, studyUpdateDestination); // nodeCreated if (!EMPTY_MODIFICATION_GROUP_UUID.equals(nodeToCopy.getModificationGroupUuid())) { - output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); // nodeUpdated + output.receive(TIMEOUT, studyUpdateDestination); // nodeUpdated } checkUpdateModelsStatusMessagesReceived(targetStudyUuid, nodesAfterDuplication.get(0)); checkElementUpdatedMessageSent(targetStudyUuid, userId); @@ -2389,7 +2389,7 @@ public void testGetDefaultProviders() throws Exception { } private void checkSubtreeMovedMessageSent(UUID studyUuid, UUID movedNodeUuid, UUID referenceNodeUuid) { - Message message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(NotificationService.SUBTREE_MOVED, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(movedNodeUuid, message.getHeaders().get(NotificationService.HEADER_MOVED_NODE)); @@ -2398,7 +2398,7 @@ private void checkSubtreeMovedMessageSent(UUID studyUuid, UUID movedNodeUuid, UU } private void checkSubtreeCreatedMessageSent(UUID studyUuid, UUID newNodeUuid, UUID referenceNodeUuid) { - Message message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(NotificationService.SUBTREE_CREATED, message.getHeaders().get(NotificationService.HEADER_UPDATE_TYPE)); assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(newNodeUuid, message.getHeaders().get(NotificationService.HEADER_NEW_NODE)); @@ -2407,7 +2407,7 @@ private void checkSubtreeCreatedMessageSent(UUID studyUuid, UUID newNodeUuid, UU } private void checkElementUpdatedMessageSent(UUID elementUuid, String userId) { - Message message = output.receive(TIMEOUT, ELEMENT_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, elementUpdateDestination); assertEquals(elementUuid, message.getHeaders().get(NotificationService.HEADER_ELEMENT_UUID)); assertEquals(userId, message.getHeaders().get(NotificationService.HEADER_MODIFIED_BY)); } @@ -2424,8 +2424,8 @@ public void reindexStudyTest() throws Exception { mockMvc.perform(post("/v1/studies/{studyUuid}/reindex-all", notExistingNetworkStudyUuid)) .andExpect(status().isInternalServerError()); - Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); - Message indexationStatusMessageNotIndexed = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, studyUpdateDestination); + Message indexationStatusMessageNotIndexed = output.receive(TIMEOUT, studyUpdateDestination); var requests = TestUtils.getRequestsWithBodyDone(1, server); assertTrue(requests.stream().anyMatch(r -> r.getPath().contains("/v1/networks/" + NOT_EXISTING_NETWORK_UUID + "/reindex-all"))); @@ -2441,13 +2441,13 @@ public void reindexStudyTest() throws Exception { mockMvc.perform(get("/v1/studies/{studyUuid}/indexation/status", study1Uuid)) .andExpectAll(status().isOk(), content().string("NOT_INDEXED")); - indexationStatusMessageNotIndexed = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + indexationStatusMessageNotIndexed = output.receive(TIMEOUT, studyUpdateDestination); mockMvc.perform(post("/v1/studies/{studyUuid}/reindex-all", study1Uuid)) .andExpect(status().isOk()); - indexationStatusMessageOnGoing = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); - Message indexationStatusMessageDone = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + indexationStatusMessageOnGoing = output.receive(TIMEOUT, studyUpdateDestination); + Message indexationStatusMessageDone = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(study1Uuid, indexationStatusMessageDone.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.UPDATE_TYPE_INDEXATION_STATUS, indexationStatusMessageDone.getHeaders().get(HEADER_UPDATE_TYPE)); @@ -2460,14 +2460,14 @@ public void reindexStudyTest() throws Exception { assertEquals(2, requests.stream().filter(r -> r.getPath().contains("/v1/networks/" + NETWORK_UUID_STRING + "/indexed-equipments")).count()); assertEquals(1, requests.stream().filter(r -> r.getPath().matches("/v1/reports/.*")).count()); - Message buildStatusMessage = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message buildStatusMessage = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(study1Uuid, buildStatusMessage.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.NODE_BUILD_STATUS_UPDATED, buildStatusMessage.getHeaders().get(HEADER_UPDATE_TYPE)); mockMvc.perform(post("/v1/studies/{studyUuid}/reindex-all", study1Uuid)) .andExpect(status().is5xxServerError()); - indexationStatusMessageOnGoing = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); - indexationStatusMessageNotIndexed = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + indexationStatusMessageOnGoing = output.receive(TIMEOUT, studyUpdateDestination); + indexationStatusMessageNotIndexed = output.receive(TIMEOUT, studyUpdateDestination); requests = TestUtils.getRequestsWithBodyDone(1, server); assertTrue(requests.stream().anyMatch(r -> r.getPath().contains("/v1/networks/" + NETWORK_UUID_STRING + "/reindex-all"))); @@ -2486,30 +2486,30 @@ public void providerTest() throws Exception { .contentType(MediaType.TEXT_PLAIN) .header(USER_ID_HEADER, USER_ID_HEADER)) .andExpect(status().isOk()); - Message message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message message = output.receive(TIMEOUT, studyUpdateDestination); assertNotNull(message); assertEquals(NotificationService.UPDATE_TYPE_LOADFLOW_STATUS, message.getHeaders().get(HEADER_UPDATE_TYPE)); - assertNotNull(output.receive(TIMEOUT, ELEMENT_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, elementUpdateDestination)); mockMvc.perform(post("/v1/studies/{studyUuid}/security-analysis/provider", studyUuid) .content("SuperSA") .contentType(MediaType.TEXT_PLAIN) .header(USER_ID_HEADER, USER_ID_HEADER)) .andExpect(status().isOk()); - message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + message = output.receive(TIMEOUT, studyUpdateDestination); assertNotNull(message); assertEquals(NotificationService.UPDATE_TYPE_SECURITY_ANALYSIS_STATUS, message.getHeaders().get(HEADER_UPDATE_TYPE)); - assertNotNull(output.receive(TIMEOUT, ELEMENT_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, elementUpdateDestination)); mockMvc.perform(post("/v1/studies/{studyUuid}/non-evacuated-energy/provider", studyUuid) .content("SuperNEE") .contentType(MediaType.TEXT_PLAIN) .header(USER_ID_HEADER, USER_ID_HEADER)) .andExpect(status().isOk()); - message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + message = output.receive(TIMEOUT, studyUpdateDestination); assertNotNull(message); assertEquals(NotificationService.UPDATE_TYPE_NON_EVACUATED_ENERGY_STATUS, message.getHeaders().get(HEADER_UPDATE_TYPE)); - assertNotNull(output.receive(TIMEOUT, ELEMENT_UPDATE_DESTINATION)); + assertNotNull(output.receive(TIMEOUT, elementUpdateDestination)); mockMvc.perform(get("/v1/studies/{studyUuid}/non-evacuated-energy/provider", studyUuid)) .andExpectAll(status().isOk(), @@ -2527,8 +2527,8 @@ public void testSupervision() throws Exception { mockMvc.perform(post("/v1/studies/{studyUuid}/reindex-all", studyUuid)) .andExpect(status().isOk()); - Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); - Message indexationStatusMessageDone = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message indexationStatusMessageOnGoing = output.receive(TIMEOUT, studyUpdateDestination); + Message indexationStatusMessageDone = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(studyUuid, indexationStatusMessageDone.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.UPDATE_TYPE_INDEXATION_STATUS, indexationStatusMessageDone.getHeaders().get(HEADER_UPDATE_TYPE)); @@ -2536,7 +2536,7 @@ public void testSupervision() throws Exception { .andExpectAll(status().isOk(), content().string("INDEXED")); - Message buildStatusMessage = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message buildStatusMessage = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(studyUuid, buildStatusMessage.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.NODE_BUILD_STATUS_UPDATED, buildStatusMessage.getHeaders().get(HEADER_UPDATE_TYPE)); @@ -2580,7 +2580,7 @@ public void testSupervision() throws Exception { assertEquals(20, Long.parseLong(mvcResult.getResponse().getContentAsString())); - Message indexationStatusMessageNotIndexed = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + Message indexationStatusMessageNotIndexed = output.receive(TIMEOUT, studyUpdateDestination); mockMvc.perform(get("/v1/studies/{studyUuid}/indexation/status", studyUuid)) .andExpectAll(status().isOk(), @@ -2594,7 +2594,7 @@ public void testSupervision() throws Exception { mockMvc.perform(delete("/v1/supervision/studies/{studyUuid}/nodes/builds", studyUuid)) .andExpect(status().isOk()); - buildStatusMessage = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION); + buildStatusMessage = output.receive(TIMEOUT, studyUpdateDestination); assertEquals(studyUuid, buildStatusMessage.getHeaders().get(NotificationService.HEADER_STUDY_UUID)); assertEquals(NotificationService.NODE_BUILD_STATUS_UPDATED, buildStatusMessage.getHeaders().get(HEADER_UPDATE_TYPE)); @@ -2613,7 +2613,7 @@ public void testSupervision() throws Exception { @After public void tearDown() { - List destinations = List.of(STUDY_UPDATE_DESTINATION, ELEMENT_UPDATE_DESTINATION); + List destinations = List.of(studyUpdateDestination, elementUpdateDestination); cleanDB();