|
25 | 25 | import org.springframework.test.web.client.MockRestServiceServer;
|
26 | 26 |
|
27 | 27 | import java.io.IOException;
|
| 28 | +import java.util.Collections; |
28 | 29 | import java.util.UUID;
|
29 | 30 |
|
30 | 31 | import static org.junit.Assert.assertEquals;
|
@@ -96,9 +97,9 @@ public void testSubstationCache() throws IOException {
|
96 | 97 | assertEquals(Boolean.TRUE, substationAttributesResource.getAttributes().getName().equals("SUBSTATION1")); // test substation name
|
97 | 98 |
|
98 | 99 | // Remove component
|
99 |
| - assertEquals(1, cachedClient.getSubstationCount(networkUuid)); |
100 |
| - cachedClient.removeSubstation(networkUuid, "sub1"); |
101 |
| - assertEquals(0, cachedClient.getSubstationCount(networkUuid)); |
| 100 | + assertEquals(1, cachedClient.getSubstations(networkUuid).size()); |
| 101 | + cachedClient.removeSubstations(networkUuid, Collections.singletonList("sub1")); |
| 102 | + assertEquals(0, cachedClient.getSubstations(networkUuid).size()); |
102 | 103 | server.verify();
|
103 | 104 | }
|
104 | 105 |
|
@@ -133,9 +134,9 @@ public void testVoltageLevelCache() throws IOException {
|
133 | 134 | assertEquals(Boolean.TRUE, voltageLevelAttributesResource.getAttributes().getName().equals("VOLTAGE_LEVEL_1")); // test voltage level name
|
134 | 135 |
|
135 | 136 | // Remove component
|
136 |
| - assertEquals(1, cachedClient.getVoltageLevelCount(networkUuid)); |
137 |
| - cachedClient.removeVoltageLevel(networkUuid, "vl1"); |
138 |
| - assertEquals(0, cachedClient.getVoltageLevelCount(networkUuid)); |
| 137 | + assertEquals(1, cachedClient.getVoltageLevels(networkUuid).size()); |
| 138 | + cachedClient.removeVoltageLevels(networkUuid, Collections.singletonList("vl1")); |
| 139 | + assertEquals(0, cachedClient.getVoltageLevels(networkUuid).size()); |
139 | 140 | server.verify();
|
140 | 141 | }
|
141 | 142 |
|
@@ -174,9 +175,9 @@ public void testSwitchCache() throws IOException {
|
174 | 175 | assertEquals(Boolean.TRUE, switchAttributesResource.getAttributes().isOpen()); // test switch is open
|
175 | 176 |
|
176 | 177 | // Remove component
|
177 |
| - assertEquals(1, cachedClient.getSwitchCount(networkUuid)); |
178 |
| - cachedClient.removeSwitch(networkUuid, "b1"); |
179 |
| - assertEquals(0, cachedClient.getSwitchCount(networkUuid)); |
| 178 | + assertEquals(1, cachedClient.getSwitches(networkUuid).size()); |
| 179 | + cachedClient.removeSwitches(networkUuid, Collections.singletonList("b1")); |
| 180 | + assertEquals(0, cachedClient.getSwitches(networkUuid).size()); |
180 | 181 | server.verify();
|
181 | 182 | }
|
182 | 183 |
|
@@ -211,9 +212,9 @@ public void testGeneratorCache() throws IOException {
|
211 | 212 | assertEquals(300., generatorAttributesResource.getAttributes().getP(), 0.001);
|
212 | 213 |
|
213 | 214 | // Remove component
|
214 |
| - assertEquals(1, cachedClient.getGeneratorCount(networkUuid)); |
215 |
| - cachedClient.removeGenerator(networkUuid, "g1"); |
216 |
| - assertEquals(0, cachedClient.getGeneratorCount(networkUuid)); |
| 215 | + assertEquals(1, cachedClient.getGenerators(networkUuid).size()); |
| 216 | + cachedClient.removeGenerators(networkUuid, Collections.singletonList("g1")); |
| 217 | + assertEquals(0, cachedClient.getGenerators(networkUuid).size()); |
217 | 218 |
|
218 | 219 | server.verify();
|
219 | 220 | }
|
@@ -253,9 +254,9 @@ public void testBatteryCache() throws IOException {
|
253 | 254 | assertEquals(150., batteryAttributesResource.getAttributes().getQ(), 0.001);
|
254 | 255 |
|
255 | 256 | // Remove component
|
256 |
| - assertEquals(1, cachedClient.getBatteryCount(networkUuid)); |
257 |
| - cachedClient.removeBattery(networkUuid, "b1"); |
258 |
| - assertEquals(0, cachedClient.getBatteryCount(networkUuid)); |
| 257 | + assertEquals(1, cachedClient.getBatteries(networkUuid).size()); |
| 258 | + cachedClient.removeBatteries(networkUuid, Collections.singletonList("b1")); |
| 259 | + assertEquals(0, cachedClient.getBatteries(networkUuid).size()); |
259 | 260 |
|
260 | 261 | server.verify();
|
261 | 262 | }
|
@@ -295,9 +296,9 @@ public void testLoadCache() throws IOException {
|
295 | 296 | assertEquals(2000., loadAttributesResource.getAttributes().getP0(), 0.001);
|
296 | 297 |
|
297 | 298 | // Remove component
|
298 |
| - assertEquals(1, cachedClient.getLoadCount(networkUuid)); |
299 |
| - cachedClient.removeLoad(networkUuid, "l1"); |
300 |
| - assertEquals(0, cachedClient.getLoadCount(networkUuid)); |
| 299 | + assertEquals(1, cachedClient.getLoads(networkUuid).size()); |
| 300 | + cachedClient.removeLoads(networkUuid, Collections.singletonList("l1")); |
| 301 | + assertEquals(0, cachedClient.getLoads(networkUuid).size()); |
301 | 302 |
|
302 | 303 | server.verify();
|
303 | 304 | }
|
@@ -333,9 +334,9 @@ public void testShuntCompensatorCache() throws IOException {
|
333 | 334 | assertEquals(8, shuntCompensatorAttributesResource.getAttributes().getSectionCount());
|
334 | 335 |
|
335 | 336 | // Remove component
|
336 |
| - assertEquals(1, cachedClient.getShuntCompensatorCount(networkUuid)); |
337 |
| - cachedClient.removeShuntCompensator(networkUuid, "sc1"); |
338 |
| - assertEquals(0, cachedClient.getShuntCompensatorCount(networkUuid)); |
| 337 | + assertEquals(1, cachedClient.getShuntCompensators(networkUuid).size()); |
| 338 | + cachedClient.removeShuntCompensators(networkUuid, Collections.singletonList("sc1")); |
| 339 | + assertEquals(0, cachedClient.getShuntCompensators(networkUuid).size()); |
339 | 340 |
|
340 | 341 | server.verify();
|
341 | 342 | }
|
@@ -375,9 +376,9 @@ public void testStaticVarCompensatorCache() throws IOException {
|
375 | 376 | assertEquals(1500., staticVarCompensatorAttributesResource.getAttributes().getReactivePowerSetPoint(), 0.001);
|
376 | 377 |
|
377 | 378 | // Remove component
|
378 |
| - assertEquals(1, cachedClient.getStaticVarCompensatorCount(networkUuid)); |
379 |
| - cachedClient.removeStaticVarCompensator(networkUuid, "svc1"); |
380 |
| - assertEquals(0, cachedClient.getStaticVarCompensatorCount(networkUuid)); |
| 379 | + assertEquals(1, cachedClient.getStaticVarCompensators(networkUuid).size()); |
| 380 | + cachedClient.removeStaticVarCompensators(networkUuid, Collections.singletonList("svc1")); |
| 381 | + assertEquals(0, cachedClient.getStaticVarCompensators(networkUuid).size()); |
381 | 382 |
|
382 | 383 | server.verify();
|
383 | 384 | }
|
@@ -413,9 +414,9 @@ public void testVscConverterStationCache() throws IOException {
|
413 | 414 | assertEquals(0.8, vscConverterStationAttributesResource.getAttributes().getLossFactor(), 0.001);
|
414 | 415 |
|
415 | 416 | // Remove component
|
416 |
| - assertEquals(1, cachedClient.getVscConverterStationCount(networkUuid)); |
417 |
| - cachedClient.removeVscConverterStation(networkUuid, "vsc1"); |
418 |
| - assertEquals(0, cachedClient.getVscConverterStationCount(networkUuid)); |
| 417 | + assertEquals(1, cachedClient.getVscConverterStations(networkUuid).size()); |
| 418 | + cachedClient.removeVscConverterStations(networkUuid, Collections.singletonList("vsc1")); |
| 419 | + assertEquals(0, cachedClient.getVscConverterStations(networkUuid).size()); |
419 | 420 |
|
420 | 421 | server.verify();
|
421 | 422 | }
|
@@ -451,9 +452,9 @@ public void testLccConverterStationCache() throws IOException {
|
451 | 452 | assertEquals(400, lccConverterStationAttributesResource.getAttributes().getPowerFactor(), 0.001);
|
452 | 453 |
|
453 | 454 | // Remove component
|
454 |
| - assertEquals(1, cachedClient.getLccConverterStationCount(networkUuid)); |
455 |
| - cachedClient.removeLccConverterStation(networkUuid, "lcc1"); |
456 |
| - assertEquals(0, cachedClient.getLccConverterStationCount(networkUuid)); |
| 455 | + assertEquals(1, cachedClient.getLccConverterStations(networkUuid).size()); |
| 456 | + cachedClient.removeLccConverterStations(networkUuid, Collections.singletonList("lcc1")); |
| 457 | + assertEquals(0, cachedClient.getLccConverterStations(networkUuid).size()); |
457 | 458 |
|
458 | 459 | server.verify();
|
459 | 460 | }
|
@@ -493,9 +494,9 @@ public void testTwoWindingsTransformerCache() throws IOException {
|
493 | 494 | assertEquals(9, twoWindingsTransformerAttributesResource.getAttributes().getX(), 0.001);
|
494 | 495 |
|
495 | 496 | // Remove component
|
496 |
| - assertEquals(1, cachedClient.getTwoWindingsTransformerCount(networkUuid)); |
497 |
| - cachedClient.removeTwoWindingsTransformer(networkUuid, "tw1"); |
498 |
| - assertEquals(0, cachedClient.getTwoWindingsTransformerCount(networkUuid)); |
| 497 | + assertEquals(1, cachedClient.getTwoWindingsTransformers(networkUuid).size()); |
| 498 | + cachedClient.removeTwoWindingsTransformers(networkUuid, Collections.singletonList("tw1")); |
| 499 | + assertEquals(0, cachedClient.getTwoWindingsTransformers(networkUuid).size()); |
499 | 500 |
|
500 | 501 | server.verify();
|
501 | 502 | }
|
@@ -545,9 +546,9 @@ public void testThreeWindingsTransformerCache() throws IOException {
|
545 | 546 | assertEquals(550, threeWindingsTransformerAttributesResource.getAttributes().getQ3(), 0.001);
|
546 | 547 |
|
547 | 548 | // Remove component
|
548 |
| - assertEquals(1, cachedClient.getThreeWindingsTransformerCount(networkUuid)); |
549 |
| - cachedClient.removeThreeWindingsTransformer(networkUuid, "tw1"); |
550 |
| - assertEquals(0, cachedClient.getThreeWindingsTransformerCount(networkUuid)); |
| 549 | + assertEquals(1, cachedClient.getThreeWindingsTransformers(networkUuid).size()); |
| 550 | + cachedClient.removeThreeWindingsTransformers(networkUuid, Collections.singletonList("tw1")); |
| 551 | + assertEquals(0, cachedClient.getThreeWindingsTransformers(networkUuid).size()); |
551 | 552 |
|
552 | 553 | server.verify();
|
553 | 554 | }
|
@@ -584,9 +585,9 @@ public void testLineCache() throws IOException {
|
584 | 585 | assertEquals(1000., lineAttributesResource.getAttributes().getP1(), 0.001);
|
585 | 586 |
|
586 | 587 | // Remove component
|
587 |
| - assertEquals(1, cachedClient.getLineCount(networkUuid)); |
588 |
| - cachedClient.removeLine(networkUuid, "l1"); |
589 |
| - assertEquals(0, cachedClient.getLineCount(networkUuid)); |
| 588 | + assertEquals(1, cachedClient.getLines(networkUuid).size()); |
| 589 | + cachedClient.removeLines(networkUuid, Collections.singletonList("l1")); |
| 590 | + assertEquals(0, cachedClient.getLines(networkUuid).size()); |
590 | 591 |
|
591 | 592 | server.verify();
|
592 | 593 | }
|
@@ -621,9 +622,9 @@ public void testHvdcLineCache() throws IOException {
|
621 | 622 | hvdcLineAttributesResource = cachedClient.getHvdcLine(networkUuid, "hvdc1").orElse(null);
|
622 | 623 | assertNotNull(hvdcLineAttributesResource);
|
623 | 624 | assertEquals(3000., hvdcLineAttributesResource.getAttributes().getMaxP(), 0.001);
|
624 |
| - assertEquals(1, cachedClient.getHvdcLineCount(networkUuid)); |
625 |
| - cachedClient.removeHvdcLine(networkUuid, "hvdc1"); |
626 |
| - assertEquals(0, cachedClient.getHvdcLineCount(networkUuid)); |
| 625 | + assertEquals(1, cachedClient.getHvdcLines(networkUuid).size()); |
| 626 | + cachedClient.removeHvdcLines(networkUuid, Collections.singletonList("hvdc1")); |
| 627 | + assertEquals(0, cachedClient.getHvdcLines(networkUuid).size()); |
627 | 628 | server.verify();
|
628 | 629 | }
|
629 | 630 |
|
@@ -691,7 +692,7 @@ public void testConfiguredBusCache() throws IOException {
|
691 | 692 | assertEquals(5., configuredBusAttributesResource.getAttributes().getAngle(), 0.001);
|
692 | 693 |
|
693 | 694 | assertEquals(1, cachedClient.getConfiguredBuses(networkUuid).size());
|
694 |
| - cachedClient.removeConfiguredBus(networkUuid, "cb1"); |
| 695 | + cachedClient.removeConfiguredBuses(networkUuid, Collections.singletonList("cb1")); |
695 | 696 | assertEquals(0, cachedClient.getConfiguredBuses(networkUuid).size());
|
696 | 697 | server.verify();
|
697 | 698 | }
|
|
0 commit comments