Skip to content

Commit

Permalink
Upgrade to powsybl-dependencies 2024.2.0 (#50)
Browse files Browse the repository at this point in the history
Signed-off-by: Franck LECUYER <[email protected]>
  • Loading branch information
FranckLecuyer authored Jul 29, 2024
1 parent 00afbca commit 1f262fd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
package com.powsybl.network.store.client;

import com.google.auto.service.AutoService;
import com.powsybl.commons.config.ConfigurationException;
import com.powsybl.commons.config.ModuleConfig;
import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.iidm.network.NetworkFactory;
import com.powsybl.iidm.network.NetworkFactoryService;
import com.powsybl.network.store.iidm.impl.NetworkFactoryImpl;

import java.util.Optional;

/**
*
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
Expand All @@ -28,8 +32,12 @@ public String getName() {

@Override
public NetworkFactory createNetworkFactory() {
String networkStoreBaseUrl = PlatformConfig.defaultConfig().getModuleConfig("network-store")
.getStringProperty("base-url");
Optional<ModuleConfig> moduleConfigOpt = PlatformConfig.defaultConfig().getOptionalModuleConfig("network-store");
if (moduleConfigOpt.isEmpty()) {
throw new ConfigurationException("Module network-store is missing in your configuration file");
}
ModuleConfig moduleConfig = moduleConfigOpt.get();
String networkStoreBaseUrl = moduleConfig.getStringProperty("base-url");
RestClient restClient = new RestClientImpl(networkStoreBaseUrl);
return new NetworkFactoryImpl(() -> new RestNetworkStoreClient(restClient));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class GroundIT extends AbstractGroundTest {

@Test
void testOnSubnetwork() {
public void testOnSubnetwork() {
// FIXME remove this test when subnetworks are implemented
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ public void assertCommand() {
public void test() throws IOException {
// import a xiidm file
Files.copy(getClass().getResourceAsStream("/test.xiidm"), fileSystem.getPath("/work/test.xiidm"));
assertCommand(new String[] {"network-store-import", "--input-file", "/work/test.xiidm"},
0,
"Importing file '/work/test.xiidm'...",
"");
assertCommandSuccessful(new String[] {"network-store-import", "--input-file", "/work/test.xiidm"},
"Importing file '/work/test.xiidm'..." + System.lineSeparator());

// get network UUID
UUID networkUuid;
Expand All @@ -112,22 +110,16 @@ public void test() throws IOException {
}

// list networks
assertCommand(new String[] {"network-store-list"},
0,
networkUuid + " : sim1",
"");
assertCommandSuccessful(new String[] {"network-store-list"},
networkUuid + " : sim1" + System.lineSeparator());

// apply groovy script
Files.copy(getClass().getResourceAsStream("/test.groovy"), fileSystem.getPath("/work/test.groovy"));
assertCommand(new String[] {"network-store-script", "--network-uuid", networkUuid.toString(), "--script-file", "/work/test.groovy"},
0,
"Applying '/work/test.groovy' on " + networkUuid + "..." + System.lineSeparator() + "id: sim1",
"");
assertCommandSuccessful(new String[] {"network-store-script", "--network-uuid", networkUuid.toString(), "--script-file", "/work/test.groovy"},
"Applying '/work/test.groovy' on " + networkUuid + "..." + System.lineSeparator() + "id: sim1");

// delete network
assertCommand(new String[] {"network-store-delete", "--network-uuid", networkUuid.toString()},
0,
"Deleting " + networkUuid + "...",
"");
assertCommandSuccessful(new String[] {"network-store-delete", "--network-uuid", networkUuid.toString()},
"Deleting " + networkUuid + "..." + System.lineSeparator());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ public void testDanglingLine() {
.add())
.getMessage().contains("reactive power setpoint"));
assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.newCurrentLimits().setPermanentLimit(-5).add())
.getMessage().contains("permanent limit must be > 0"));
.getMessage().contains("permanent limit must be >= 0"));
assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.newCurrentLimits().setPermanentLimit(10)
.beginTemporaryLimit().endTemporaryLimit().add())
.getMessage().contains("temporary limit value is not set"));
assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.newCurrentLimits().setPermanentLimit(10)
.beginTemporaryLimit().setValue(-1).endTemporaryLimit().add())
.getMessage().contains("temporary limit value must be > 0"));
.getMessage().contains("temporary limit value must be >= 0"));
assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.newCurrentLimits().setPermanentLimit(10)
.beginTemporaryLimit().setValue(10).setAcceptableDuration(-1).endTemporaryLimit().add())
.getMessage().contains("acceptable duration must be >= 0"));
Expand All @@ -392,7 +392,7 @@ public void testDanglingLine() {
.endTemporaryLimit()
.add();

assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.getCurrentLimits().orElseThrow().setPermanentLimit(-50)).getMessage().contains("permanent limit must be > 0"));
assertTrue(assertThrows(PowsyblException.class, () -> danglingLine1.getCurrentLimits().orElseThrow().setPermanentLimit(-50)).getMessage().contains("permanent limit must be >= 0"));

DanglingLine danglingLine2 = vl1.newDanglingLine().setId("DL2").setNode(2).setP0(1).setQ0(1).setR(1).setX(1).setG(1).setB(1)
.newGeneration().setMinP(100).setMaxP(200).setTargetP(500).setVoltageRegulationOn(false).setTargetV(300).setTargetQ(100).add()
Expand Down Expand Up @@ -544,7 +544,7 @@ public void testTwoWindingsTransformer() {

assertTrue(assertThrows(PowsyblException.class, () -> t2e.newPhaseTapChanger().add()).getMessage().contains("tap position is not set"));
assertTrue(assertThrows(PowsyblException.class, () -> t2e.newPhaseTapChanger().setTapPosition(3).add())
.getMessage().contains("a phase tap changer shall have at least one step"));
.getMessage().contains("phase tap changer should have at least one step"));
assertTrue(assertThrows(PowsyblException.class, () -> t2e.newPhaseTapChanger().setTapPosition(3).beginStep().endStep().add())
.getMessage().contains("step alpha is not set"));
assertTrue(assertThrows(PowsyblException.class, () -> t2e.newPhaseTapChanger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ private void createGeneratorMappings() {
generatorMappings.addColumnMapping(ALIASES_WITHOUT_TYPE, new ColumnMapping<>(Set.class, GeneratorAttributes::getAliasesWithoutType, GeneratorAttributes::setAliasesWithoutType));
generatorMappings.addColumnMapping(POSITION, new ColumnMapping<>(ConnectablePositionAttributes.class, GeneratorAttributes::getPosition, GeneratorAttributes::setPosition));
generatorMappings.addColumnMapping("generatorShortCircuit", new ColumnMapping<>(GeneratorShortCircuitAttributes.class, GeneratorAttributes::getGeneratorShortCircuitAttributes, GeneratorAttributes::setGeneratorShortCircuitAttributes));
generatorMappings.addColumnMapping("condenser", new ColumnMapping<>(Boolean.class, GeneratorAttributes::isCondenser, GeneratorAttributes::setCondenser));
}

public TableMapping getSwitchMappings() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.10.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd" logicalFilePath="db/changelog/changesets/changelog_2022-10-05T13:44:00Z.xml">
<changeSet author="lecuyerfra" id="1793174319709-1">
<addColumn tableName="generator">
<column name="condenser" type="BOOLEAN"/>
</addColumn>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ databaseChangeLog:
- include:
file: changesets/changelog_20240529T130300Z.xml
relativeToChangelogFile: true

- include:
file: changesets/changelog_20240701T114700Z.xml
relativeToChangelogFile: true
23 changes: 1 addition & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@
<properties>
<sirocco.version>1.0</sirocco.version>

<powsybl-ws-dependencies.version>2.11.0</powsybl-ws-dependencies.version>
<!-- FIXME: powsybl-network-store modules'version is overloaded in the dependencies section.The overloads and this property below have to be removed at next powsybl-ws-dependencies.version upgrade -->
<powsybl-network-store.version>1.13.0</powsybl-network-store.version>

<powsybl-ws-dependencies.version>2.12.0</powsybl-ws-dependencies.version>

<!-- FIXME : to remove when sonar version is updated on github actions -->
<!-- https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324 -->
Expand All @@ -78,24 +75,6 @@
<dependencyManagement>
<dependencies>
<!-- overrides of imports -->
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-iidm-impl</artifactId>
<version>${powsybl-network-store.version}</version>
</dependency>
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-client</artifactId>
<version>${powsybl-network-store.version}</version>
</dependency>
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-model</artifactId>
<version>${powsybl-network-store.version}</version>
</dependency>

<!-- imports -->
<dependency>
Expand Down

0 comments on commit 1f262fd

Please sign in to comment.