Skip to content

Commit 3ee1f7f

Browse files
authored
fix endpoint feeder-bays (#308)
Signed-off-by: Rehili Ghazwa <[email protected]>
1 parent 8d3fd77 commit 3ee1f7f

File tree

5 files changed

+39
-83
lines changed

5 files changed

+39
-83
lines changed

src/main/java/org/gridsuite/network/map/NetworkMapController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.gridsuite.network.map.dto.InfoTypeParameters;
2121
import org.gridsuite.network.map.dto.definition.hvdc.HvdcShuntCompensatorsInfos;
2222
import org.gridsuite.network.map.dto.definition.topology.BusBarSectionsInfos;
23-
import org.gridsuite.network.map.dto.definition.topology.FeederBaysBusBarSectionsInfos;
23+
import org.gridsuite.network.map.dto.definition.topology.FeederBayInfos;
2424
import org.gridsuite.network.map.dto.definition.topology.SwitchInfos;
2525
import org.gridsuite.network.map.services.NetworkMapService;
2626
import org.springframework.context.annotation.ComponentScan;
@@ -95,12 +95,12 @@ public List<ElementInfos> getVoltageLevelBusesOrBusBarSections(@Parameter(descri
9595
return networkMapService.getVoltageLevelBusesOrBusbarSections(networkUuid, voltageLevelId, variantId);
9696
}
9797

98-
@GetMapping(value = "/networks/{networkUuid}/voltage-levels/{voltageLevelId}/feeder-bays-and-bus-bar-sections", produces = APPLICATION_JSON_VALUE)
98+
@GetMapping(value = "/networks/{networkUuid}/voltage-levels/{voltageLevelId}/feeder-bays", produces = APPLICATION_JSON_VALUE)
9999
@Operation(summary = "get feeder bays and bus bar sections information")
100100
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = " feeder bays and bus bar sections information retrieved")})
101-
public FeederBaysBusBarSectionsInfos getFeederBaysInfos(@Parameter(description = "Network UUID") @PathVariable("networkUuid") UUID networkUuid,
102-
@Parameter(description = "Voltage level id") @PathVariable("voltageLevelId") String voltageLevelId,
103-
@Parameter(description = "Variant Id") @RequestParam(name = "variantId", required = false) String variantId) {
101+
public Map<String, List<FeederBayInfos>> getFeederBaysInfos(@Parameter(description = "Network UUID") @PathVariable("networkUuid") UUID networkUuid,
102+
@Parameter(description = "Voltage level id") @PathVariable("voltageLevelId") String voltageLevelId,
103+
@Parameter(description = "Variant Id") @RequestParam(name = "variantId", required = false) String variantId) {
104104
return networkMapService.getFeederBaysInfos(networkUuid, voltageLevelId, variantId);
105105
}
106106

src/main/java/org/gridsuite/network/map/dto/definition/topology/FeederBaysBusBarSectionsInfos.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main/java/org/gridsuite/network/map/services/NetworkMapService.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.gridsuite.network.map.dto.InfoTypeParameters;
1919
import org.gridsuite.network.map.dto.definition.hvdc.HvdcShuntCompensatorsInfos;
2020
import org.gridsuite.network.map.dto.definition.topology.BusBarSectionsInfos;
21-
import org.gridsuite.network.map.dto.definition.topology.FeederBaysBusBarSectionsInfos;
21+
import org.gridsuite.network.map.dto.definition.topology.FeederBayInfos;
2222
import org.gridsuite.network.map.dto.definition.topology.SwitchInfos;
2323
import org.gridsuite.network.map.dto.mapper.ElementInfosMapper;
2424
import org.gridsuite.network.map.dto.mapper.HvdcInfosMapper;
@@ -137,13 +137,10 @@ public BusBarSectionsInfos getBusBarSectionsInfos(UUID networkUuid, String volta
137137
return TopologyUtils.getBusBarSectionsInfos(voltageLevel);
138138
}
139139

140-
public FeederBaysBusBarSectionsInfos getFeederBaysInfos(UUID networkUuid, String voltageLevelId, String variantId) {
140+
public Map<String, List<FeederBayInfos>> getFeederBaysInfos(UUID networkUuid, String voltageLevelId, String variantId) {
141141
Network network = getNetwork(networkUuid, PreloadingStrategy.NONE, variantId);
142142
VoltageLevel voltageLevel = network.getVoltageLevel(voltageLevelId);
143-
FeederBaysBusBarSectionsInfos.FeederBaysBusBarSectionsInfosBuilder<?, ?> builder = FeederBaysBusBarSectionsInfos.builder();
144-
builder.feederBaysInfos(TopologyUtils.getFeederBaysInfos(voltageLevel));
145-
builder.busBarSectionsInfos(TopologyUtils.getBusBarSectionsInfos(voltageLevel));
146-
return builder.build();
143+
return TopologyUtils.getFeederBaysInfos(voltageLevel);
147144
}
148145

149146
public List<SwitchInfos> getSwitchInfos(UUID networkUuid, String voltageLevelId, String variantId) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,8 @@ private static String resourceToString(String resource) throws IOException {
14461446
return new String(ByteStreams.toByteArray(NetworkMapControllerTest.class.getResourceAsStream(resource)), StandardCharsets.UTF_8);
14471447
}
14481448

1449-
private void succeedingTestGettingFeederBaysAndBusBarSectionsInfos(UUID networkUuid, String variantId, String voltageLevelId, String expectedJson) throws Exception {
1450-
MvcResult res = mvc.perform(get("/v1/networks/{networkUuid}/voltage-levels/{voltageLevelId}/feeder-bays-and-bus-bar-sections", networkUuid, voltageLevelId)
1449+
private void succeedingTestGettingFeederBaysInfos(UUID networkUuid, String variantId, String voltageLevelId, String expectedJson) throws Exception {
1450+
MvcResult res = mvc.perform(get("/v1/networks/{networkUuid}/voltage-levels/{voltageLevelId}/feeder-bays", networkUuid, voltageLevelId)
14511451
.queryParam(QUERY_PARAM_VARIANT_ID, variantId))
14521452
.andExpect(status().isOk())
14531453
.andReturn();
@@ -2376,7 +2376,7 @@ void shouldReturnVoltageLevelBusbarSectionsFormInfos() throws Exception {
23762376

23772377
@Test
23782378
void shouldReturnVoltageLevelFeederBaysFormInfos() throws Exception {
2379-
succeedingTestGettingFeederBaysAndBusBarSectionsInfos(NETWORK_UUID, null, "VLGEN4", resourceToString("/feeder-bays-data.json"));
2379+
succeedingTestGettingFeederBaysInfos(NETWORK_UUID, null, "VLGEN4", resourceToString("/feeder-bays-data.json"));
23802380
}
23812381

23822382
@Test
Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,31 @@
11
{
2-
"feederBaysInfos": {
3-
"SHUNT_VLNB": [
4-
{
5-
"busbarSectionId": "NGEN4",
6-
"connectablePositionInfos": {
7-
"connectionDirection": null
8-
},
9-
"connectionSide": null
10-
}
11-
],
12-
"LINE7": [
13-
{
14-
"busbarSectionId": "NGEN4",
15-
"connectablePositionInfos": {
16-
"connectionDirection": "BOTTOM",
17-
"connectionPosition": 5,
18-
"connectionName": "LINE7_Side_VLGEN4"
19-
},
20-
"connectionSide": "ONE"
21-
}
22-
],
23-
"SHUNT_NON_LINEAR": [
24-
{
25-
"busbarSectionId": "NGEN4",
26-
"connectablePositionInfos": {
27-
"connectionDirection": null
28-
},
29-
"connectionSide": null
30-
}
31-
]
32-
},
33-
"busBarSectionsInfos": {
34-
"topologyKind": "NODE_BREAKER",
35-
"isSymmetrical": true,
36-
"isBusbarSectionPositionFound": true,
37-
"busBarSections": {
38-
"1": [
39-
"NGEN4"
40-
]
2+
"SHUNT_VLNB": [
3+
{
4+
"busbarSectionId": "NGEN4",
5+
"connectablePositionInfos": {
6+
"connectionDirection": null
7+
},
8+
"connectionSide": null
419
}
42-
}
10+
],
11+
"LINE7": [
12+
{
13+
"busbarSectionId": "NGEN4",
14+
"connectablePositionInfos": {
15+
"connectionDirection": "BOTTOM",
16+
"connectionPosition": 5,
17+
"connectionName": "LINE7_Side_VLGEN4"
18+
},
19+
"connectionSide": "ONE"
20+
}
21+
],
22+
"SHUNT_NON_LINEAR": [
23+
{
24+
"busbarSectionId": "NGEN4",
25+
"connectablePositionInfos": {
26+
"connectionDirection": null
27+
},
28+
"connectionSide": null
29+
}
30+
]
4331
}

0 commit comments

Comments
 (0)