Skip to content

Commit 854bd61

Browse files
committed
add a test with a vl without substation
1 parent 4b84f2c commit 854bd61

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/test/java/org/gridsuite/geodata/server/GeoDataServiceTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ void testNonExisting() {
245245
.setG2(0.0)
246246
.setB2(386E-6 / 2)
247247
.add();
248+
// if not geo-data is associated to a substation, this substation shold not be mentionned in the returned value
248249
List<SubstationGeoData> substationsGeoData = geoDataService.getSubstationsByCountries(network, new HashSet<>(Collections.singletonList(Country.FR)));
249250
assertFalse(substationsGeoData.stream().anyMatch(Objects::isNull), "Must not contain nulls");
250251
assertFalse(substationsGeoData.stream().anyMatch(s -> notexistsub1.getId().equals(s.getId())),
@@ -258,6 +259,35 @@ void testNonExisting() {
258259
"Must not contain unknown lines " + notexistline.getId());
259260
}
260261

262+
@Test
263+
void outOfSubstationVoltageLevelShouldNotHinderLineDataGathering() {
264+
Network network = EurostagTutorialExample1Factory.create();
265+
List<VoltageLevel> existingVls = network.getVoltageLevelStream().toList();
266+
List<Line> existingLines = network.getLineStream().toList();
267+
VoltageLevel p1 = network.newVoltageLevel()
268+
.setId("PIQUAGE1").setNominalV(380).setTopologyKind(TopologyKind.BUS_BREAKER)
269+
.add();
270+
Bus bus1 = p1.getBusBreakerView().newBus()
271+
.setId("NPIQ1")
272+
.add();
273+
Line halfPiq = network.newLine()
274+
.setId("LINE_PIQ_AT_A_SIDE")
275+
.setVoltageLevel1(existingVls.get(0).getId())
276+
.setBus1(existingVls.get(0).getBusBreakerView().getBuses().iterator().next().getId())
277+
.setConnectableBus1(existingVls.get(0).getBusBreakerView().getBuses().iterator().next().getId())
278+
.setVoltageLevel2(p1.getId()).setBus2(bus1.getId()).setConnectableBus2(bus1.getId())
279+
.setR(3.0)
280+
.setX(33.0)
281+
.setG1(0.0)
282+
.setB1(386E-6 / 2)
283+
.setG2(0.0)
284+
.setB2(386E-6 / 2)
285+
.add();
286+
287+
List<LineGeoData> linesGeoData = geoDataService.getLinesByCountries(network, new HashSet<>(Collections.singletonList(Country.FR)));
288+
assertEquals(2, linesGeoData.size());
289+
}
290+
261291
@Test
262292
void testSimilarNeighborhoodOffset() {
263293
Network network = EurostagTutorialExample1Factory.create();

0 commit comments

Comments
 (0)