-
Notifications
You must be signed in to change notification settings - Fork 2
merge some modifications into a new composite #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3b7ef00
6bace98
fad9146
5cc2b60
15bbd40
1e7338f
2eb2141
086eb96
526a44a
be9e3fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2116,6 +2116,53 @@ void testInsertComposite() throws Exception { | |
| expectedBody); | ||
| } | ||
|
|
||
| @Test | ||
| void testMergeModificationsIntoNewComposite() throws Exception { | ||
| String userId = "userId"; | ||
| StudyEntity studyEntity = insertDummyStudy(UUID.fromString(NETWORK_UUID_STRING), CASE_UUID, "UCTE"); | ||
| UUID studyUuid = studyEntity.getId(); | ||
| UUID rootNodeUuid = getRootNode(studyUuid).getId(); | ||
|
|
||
| NetworkModificationNode node1 = createNetworkModificationNode(studyUuid, rootNodeUuid, | ||
| UUID.randomUUID(), VARIANT_ID, "New node 1", userId); | ||
| UUID nodeUuid1 = node1.getId(); | ||
|
|
||
| UUID modification1 = UUID.randomUUID(); | ||
| UUID modification2 = UUID.randomUUID(); | ||
| List<UUID> modificationUuids = List.of(modification1, modification2); | ||
| String modificationsData = mapper.writeValueAsString(modificationUuids); | ||
|
|
||
| UUID newCompositeUuid = UUID.randomUUID(); | ||
|
|
||
| wireMockServer.stubFor(WireMock.post(WireMock.urlPathMatching("/v1/network-composite-modifications/composite-modification")) | ||
| .willReturn(WireMock.ok() | ||
| .withBody(mapper.writeValueAsString(newCompositeUuid)) | ||
| .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))); | ||
|
|
||
| MvcResult mvcResult = mockMvc.perform(post("/v1/studies/{studyUuid}/nodes/{nodeUuid}/composite-modification", | ||
| studyUuid, nodeUuid1) | ||
| .contentType(MediaType.APPLICATION_JSON) | ||
| .content(modificationsData) | ||
| .header(USER_ID_HEADER, userId)) | ||
| .andExpect(status().isOk()) | ||
| .andReturn(); | ||
|
|
||
| UUID resultUuid = mapper.readValue(mvcResult.getResponse().getContentAsString(), UUID.class); | ||
| assertEquals(newCompositeUuid, resultUuid); | ||
|
|
||
| checkUpdateStatusMessagesReceived(studyUuid, nodeUuid1, output); | ||
| checkEquipmentUpdatingMessagesReceived(studyUuid, nodeUuid1); | ||
| checkEquipmentUpdatingFinishedMessagesReceived(studyUuid, nodeUuid1); | ||
| checkElementUpdatedMessageSent(studyUuid, userId); | ||
|
|
||
| WireMockUtilsCriteria.verifyPostRequest( | ||
| wireMockServer, | ||
| "/v1/network-composite-modifications/composite-modification", | ||
| Map.of(), | ||
| 1 | ||
| ); | ||
|
Comment on lines
+2158
to
+2163
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verify the request body sent to the composite-modification endpoint. The test verifies that the WireMock POST endpoint was called, but does not verify that the correct modification UUIDs were sent in the request body. According to the service layer contract, 🧪 Suggested enhancement to verify request body+ String expectedBody = mapper.writeValueAsString(modificationUuids);
+
WireMockUtilsCriteria.verifyPostRequest(
wireMockServer,
"/v1/network-composite-modifications/composite-modification",
Map.of(),
+ expectedBody,
1
);Note: You may need to verify the actual signature of 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| @Test | ||
| void testDuplicateModification() throws Exception { | ||
| String userId = "userId"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.