Skip to content

Commit c08a6e7

Browse files
fix: tests and sonar
Signed-off-by: Joris Mancini <[email protected]>
1 parent 33e22d1 commit c08a6e7

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

src/main/java/org/gridsuite/network/map/dto/mapper/BranchInfosMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static ElementInfos toData(@NonNull final Identifiable<?> identifiable,
4040
final Branch<?> branch = (Branch<?>) identifiable;
4141
final Double dcPowerFactor = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_DC_POWERFACTOR))
4242
.map(Double::valueOf).orElse(null);
43-
final Boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
43+
final boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
4444
.map(Boolean::valueOf).orElse(false);
4545
return switch (infoTypeParameters.getInfoType()) {
4646
case TAB -> toTabInfos(branch, dcPowerFactor, loadOperationalLimitGroups);
@@ -52,7 +52,7 @@ public static ElementInfos toData(@NonNull final Identifiable<?> identifiable,
5252
@NonNull final B builder,
5353
@NonNull final Branch<?> branch,
5454
@Nullable final Double dcPowerFactor,
55-
@NonNull final Boolean loadOperationalLimitGroups
55+
@NonNull final boolean loadOperationalLimitGroups
5656
) {
5757
/* even if x & r properties are in branch properties doc, it is not in branch getter but each impls... */
5858
//TODO https://github.com/powsybl/powsybl-core/issues/3521 tagged for release 09/2025

src/main/java/org/gridsuite/network/map/dto/mapper/GeneratorInfosMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private GeneratorInfosMapper() {
4343
}
4444

4545
public static ElementInfos toData(Identifiable<?> identifiable, InfoTypeParameters infoTypeParameters) {
46-
Boolean loadRegulatingTerminals = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_REGULATING_TERMINALS))
46+
boolean loadRegulatingTerminals = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_REGULATING_TERMINALS))
4747
.map(Boolean::valueOf).orElse(false);
4848
return switch (infoTypeParameters.getInfoType()) {
4949
case TAB -> toTabInfos(identifiable, loadRegulatingTerminals);
@@ -63,7 +63,7 @@ private static List<ReactiveCapabilityCurveMapData> getReactiveCapabilityCurvePo
6363
.collect(Collectors.toList());
6464
}
6565

66-
private static GeneratorTabInfos toTabInfos(Identifiable<?> identifiable, Boolean loadRegulatingTerminals) {
66+
private static GeneratorTabInfos toTabInfos(Identifiable<?> identifiable, boolean loadRegulatingTerminals) {
6767
Generator generator = (Generator) identifiable;
6868
Terminal terminal = generator.getTerminal();
6969
GeneratorTabInfos.GeneratorTabInfosBuilder<?, ?> builder = GeneratorTabInfos.builder()

src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private LineInfosMapper() {
3333
public static ElementInfos toData(Identifiable<?> identifiable, InfoTypeParameters infoTypeParameters) {
3434
String dcPowerFactorStr = infoTypeParameters.getOptionalParameters().getOrDefault(QUERY_PARAM_DC_POWERFACTOR, null);
3535
Double dcPowerFactor = dcPowerFactorStr == null ? null : Double.valueOf(dcPowerFactorStr);
36-
Boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
36+
boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
3737
.map(Boolean::valueOf).orElse(false);
3838
return switch (infoTypeParameters.getInfoType()) {
3939
case TAB -> toTabInfos(identifiable, dcPowerFactor, loadOperationalLimitGroups);
@@ -136,7 +136,7 @@ private static LineMapInfos toMapInfos(Identifiable<?> identifiable, Double dcPo
136136
return builder.build();
137137
}
138138

139-
private static LineTabInfos toTabInfos(Identifiable<?> identifiable, Double dcPowerFactor, Boolean loadOperationalLimitGroups) {
139+
private static LineTabInfos toTabInfos(Identifiable<?> identifiable, Double dcPowerFactor, boolean loadOperationalLimitGroups) {
140140
final Line line = (Line) identifiable;
141141
return toTabBuilder((LineTabInfosBuilder<LineTabInfos, ?>) LineTabInfos.builder(), line, dcPowerFactor, loadOperationalLimitGroups)
142142
.g1(line.getG1())

src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private TwoWindingsTransformerInfosMapper() {
4242
public static ElementInfos toData(Identifiable<?> identifiable, InfoTypeParameters infoTypeParameters) {
4343
String dcPowerFactorStr = infoTypeParameters.getOptionalParameters().getOrDefault(QUERY_PARAM_DC_POWERFACTOR, null);
4444
Double dcPowerFactor = dcPowerFactorStr == null ? null : Double.valueOf(dcPowerFactorStr);
45-
Boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
45+
boolean loadOperationalLimitGroups = Optional.ofNullable(infoTypeParameters.getOptionalParameters().get(QUERY_PARAM_LOAD_OPERATIONAL_LIMIT_GROUPS))
4646
.map(Boolean::valueOf).orElse(false);
4747
return switch (infoTypeParameters.getInfoType()) {
4848
case LIST -> ElementInfosMapper.toListInfos(identifiable);
@@ -108,7 +108,7 @@ private static TwoWindingsTransformerFormInfos toFormInfos(Identifiable<?> ident
108108
return builder.build();
109109
}
110110

111-
private static TwoWindingsTransformerTabInfos toTabInfos(Identifiable<?> identifiable, Double dcPowerFactor, Boolean loadOperationalLimitGroups) {
111+
private static TwoWindingsTransformerTabInfos toTabInfos(Identifiable<?> identifiable, Double dcPowerFactor, boolean loadOperationalLimitGroups) {
112112
final TwoWindingsTransformer twoWT = (TwoWindingsTransformer) identifiable;
113113
return toTabBuilder((TwoWindingsTransformerTabInfosBuilder<TwoWindingsTransformerTabInfos, ?>) TwoWindingsTransformerTabInfos.builder(), twoWT, dcPowerFactor, loadOperationalLimitGroups)
114114
.country(ElementUtils.mapCountry(ElementUtils.findFirstSubstation(List.of(twoWT.getTerminal1(), twoWT.getTerminal2()))))

src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,16 +1569,6 @@ private void succeedingTestForEquipmentsInfos(UUID networkUuid, String variantId
15691569
JSONAssert.assertEquals(expectedJson, mvcResult.getResponse().getContentAsString(), JSONCompareMode.NON_EXTENSIBLE);
15701570
}
15711571

1572-
private void notFoundTestForEquipmentsInfos(UUID networkUuid, String variantId, String infosPath, List<String> substationsIds) throws Exception {
1573-
LinkedMultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
1574-
queryParams.add(QUERY_PARAM_VARIANT_ID, variantId);
1575-
if (!substationsIds.isEmpty()) {
1576-
queryParams.addAll(QUERY_PARAM_SUBSTATION_ID, substationsIds);
1577-
}
1578-
mvc.perform(get("/v1/networks/{networkUuid}/{infosPath}", networkUuid, infosPath).queryParams(queryParams))
1579-
.andExpect(status().isNotFound());
1580-
}
1581-
15821572
private void shouldNotExistBranchOr3WTVoltageLevelId(UUID networkUuid, String variantId, ThreeSides side, String equipmentId) throws Exception {
15831573
mvc.perform(get("/v1/networks/{networkUuid}/branch-or-3wt/{equipmentId}/voltage-level-id", networkUuid, equipmentId)
15841574
.queryParam(QUERY_PARAM_VARIANT_ID, variantId)

0 commit comments

Comments
 (0)