@@ -1123,6 +1123,7 @@ private void testNetworkModificationsCount(UUID groupUuid, int actualSize) throw
1123
1123
assertEquals (actualSize , modificationsTestGroupId .size ());
1124
1124
}
1125
1125
1126
+
1126
1127
@ Test
1127
1128
public void shouldGetPosition () {
1128
1129
var network = networkStoreService .getNetwork (TEST_NETWORK_ID , null );
@@ -1326,4 +1327,50 @@ public void testDeleteStashedNetworkModifications() throws Exception {
1326
1327
assertEquals (0 , modificationRepository .getModifications (TEST_GROUP_ID , false , true , true ).size ());
1327
1328
mockMvc .perform (delete ("/v1/groups/" + UUID .randomUUID () + "/stashed-modifications" ).queryParam ("errorOnGroupNotFound" , "false" )).andExpect (status ().isOk ());
1328
1329
}
1330
+
1331
+ @ Test
1332
+ public void testGetAllNetworkModifications () throws Exception {
1333
+ List <EquipmentAttributeModificationInfos > loadModificationInfosList = List .of (
1334
+ EquipmentAttributeModificationInfos .builder ()
1335
+ .equipmentType (IdentifiableType .LOAD )
1336
+ .equipmentAttributeName ("v1load" )
1337
+ .equipmentId ("v1load" )
1338
+ .build (),
1339
+ EquipmentAttributeModificationInfos .builder ()
1340
+ .equipmentType (IdentifiableType .LOAD )
1341
+ .equipmentAttributeName ("v2load" )
1342
+ .equipmentId ("v2load" )
1343
+ .build ());
1344
+ loadModificationInfosList .stream ().forEach (loadModificationInfos -> {
1345
+ try {
1346
+ String loadModificationInfosJson = objectWriter .writeValueAsString (loadModificationInfos );
1347
+ MvcResult mvcResult = mockMvc .perform (post (URI_NETWORK_MODIF )
1348
+ .content (loadModificationInfosJson )
1349
+ .contentType (MediaType .APPLICATION_JSON ))
1350
+ .andExpect (status ().isOk ())
1351
+ .andReturn ();
1352
+ assertApplicationStatusOK (mvcResult );
1353
+ } catch (Exception e ) {
1354
+ e .printStackTrace ();
1355
+ }
1356
+ });
1357
+
1358
+ List <ModificationInfos > modifications = modificationRepository .getModifications (TEST_GROUP_ID , false , true );
1359
+ assertEquals (2 , modifications .size ());
1360
+
1361
+ mockMvc .perform (delete (URI_NETWORK_MODIF_BASE )
1362
+ .queryParam ("groupUuid" , TEST_GROUP_ID .toString ())
1363
+ .queryParam ("uuids" , modifications .get (0 ).getUuid ().toString ())
1364
+ .queryParam ("stash" , "true" ))
1365
+ .andExpect (status ().isOk ());
1366
+ MvcResult mvcResult = mockMvc .perform (get ("/v1/groups/{groupUuid}/modifications" , TEST_GROUP_ID )).andExpectAll (
1367
+ status ().isOk (),
1368
+ content ().contentType (MediaType .APPLICATION_JSON ))
1369
+ .andReturn ();
1370
+ String resultAsString = mvcResult .getResponse ().getContentAsString ();
1371
+ List <ModificationInfos > bsicListResulModifInfos = mapper .readValue (resultAsString , new TypeReference <>() { });
1372
+ assertEquals (2 , bsicListResulModifInfos .size ());
1373
+ assertEquals (bsicListResulModifInfos .get (0 ).getStashed (), true );
1374
+ assertEquals (bsicListResulModifInfos .get (1 ).getStashed (), false );
1375
+ }
1329
1376
}
0 commit comments