Skip to content

Commit e1f2bc6

Browse files
committed
update comments
Signed-off-by: David BRAQUART <[email protected]>
1 parent 966741e commit e1f2bc6

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,16 @@ public void deleteAll() {
104104
modificationGroupRepository.deleteAll();
105105
}
106106

107-
@Transactional // To have all create in the same transaction (atomic)
108-
// TODO Remove transaction when errors will no longer be sent to the front
109-
// This method should be package-private and not used as API of the service as it uses ModificationEntity and
110-
// we want to encapsulate the use of Entity related objects to this service.
111-
// Nevertheless We have to keep it public for transactional annotation.
107+
@Transactional
108+
// TODO Rather than calling saveModificationsNonTransactional(), we should call saveModificationInfos() below.
109+
// In this case, we could change this method signature to use DTOs instead of Entities.
110+
// Note: This current method is used only by the tests.
112111
public List<ModificationEntity> saveModifications(UUID groupUuid, List<ModificationEntity> modifications) {
113112
return saveModificationsNonTransactional(groupUuid, modifications);
114113
}
115114

116115
public List<ModificationEntity> saveModificationInfos(UUID groupUuid, List<ModificationInfos> modifications) {
117116
List<ModificationEntity> entities = modifications.stream().map(ModificationEntity::fromDTO).toList();
118-
119117
return saveModificationsNonTransactional(groupUuid, entities);
120118
}
121119

src/test/java/org/gridsuite/modification/server/ModificationControllerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ void testNetworkModificationsWithErrorOnNetworkFlush() throws Exception {
450450
String groovyScriptInfosJson = getJsonBody(groovyScriptInfos, TEST_NETWORK_WITH_FLUSH_ERROR_ID, NetworkCreation.VARIANT_ID);
451451

452452
mockMvc.perform(post(NETWORK_MODIFICATION_URI).content(groovyScriptInfosJson).contentType(MediaType.APPLICATION_JSON)).andExpect(status().is5xxServerError());
453-
453+
// TODO because creating a modification is now a unique Tx, and because network.flush() is not covered by the apply() exception catch,
454+
// this test result has changed : the modification save is not committed because of the flush exception.
454455
assertEquals(0, modificationRepository.getModifications(TEST_GROUP_ID, true, false).size());
455456
}
456457

src/test/java/org/gridsuite/modification/server/modifications/tabularcreations/TabularGeneratorCreationsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void testUnsupportedTabularCreationType() throws Exception {
338338
.build();
339339
String tabularCreationJson = getJsonBody(creationInfos, null);
340340

341-
// try to create something impossible
341+
// try to create+apply a tabular creation with an unsupported type
342342
ServletException exception = assertThrows(
343343
ServletException.class,
344344
() -> mockMvc.perform(post(getNetworkModificationUri()).content(tabularCreationJson).contentType(MediaType.APPLICATION_JSON))

src/test/java/org/gridsuite/modification/server/modifications/tabularmodifications/TabularGeneratorModificationsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ void testUnsupportedTabularModificationType() throws Exception {
595595
.build();
596596
String tabularModificationJson = getJsonBody(tabularInfos, null);
597597

598-
// try to create something impossible
598+
// try to create+apply a tabular modification with an unsupported type
599599
ServletException exception = assertThrows(
600600
ServletException.class,
601601
() -> mockMvc.perform(post(getNetworkModificationUri()).content(tabularModificationJson).contentType(MediaType.APPLICATION_JSON))

0 commit comments

Comments
 (0)