Skip to content

Commit

Permalink
Fix code smells
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Jul 1, 2024
1 parent 30d612a commit 84da059
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ class DynaFlowParametersTest extends AbstractSerDeTest {
private InMemoryPlatformConfig platformConfig;

@BeforeEach
@Override
public void setUp() {
fileSystem = Jimfs.newFileSystem(Configuration.unix());
platformConfig = new InMemoryPlatformConfig(fileSystem);
}

@AfterEach
@Override
public void tearDown() throws IOException {
fileSystem.close();
}
Expand All @@ -67,9 +69,6 @@ void checkParameters() {
StartingPointMode startingPointMode = StartingPointMode.FLAT;
boolean mergeLoads = false;

DynaFlowParameters.Sa securityAnalysis = new DynaFlowParameters.Sa();
securityAnalysis.setTimeOfEvent(2.);

MapModuleConfig moduleConfig = platformConfig.createModuleConfig(MODULE_SPECIFIC_PARAMETERS);
moduleConfig.setStringProperty("svcRegulationOn", Boolean.toString(svcRegulationOn));
moduleConfig.setStringProperty("shuntRegulationOn", Boolean.toString(shuntRegulationOn));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class DynaFlowProviderTest extends AbstractSerDeTest {
private DynaFlowProvider provider;

@BeforeEach
@Override
public void setUp() throws IOException {
super.setUp();
homeDir = fileSystem.getPath("/home/dynaflow");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import java.util.Objects;
import java.util.concurrent.CompletableFuture;

import static com.powsybl.dynawaltz.DynaWaltzConfig.DYNAWALTZ_LAUNCHER_PROGRAM_NAME;

/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
Expand Down Expand Up @@ -77,7 +79,7 @@ public CompletableFuture<SecurityAnalysisReport> run(Network network, String wor
ReportNode dsaReportNode = DynamicSecurityAnalysisReports.createDynamicSecurityAnalysisReportNode(runParameters.getReportNode(), network.getId());
network.getVariantManager().setWorkingVariant(workingVariantId);
ExecutionEnvironment execEnv = new ExecutionEnvironment(Collections.emptyMap(), WORKING_DIR_PREFIX, config.isDebug());
DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DynawoAlgorithmsConfig.DYNAWALTZ_LAUNCHER_PROGRAM_NAME, false);
DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWALTZ_LAUNCHER_PROGRAM_NAME, false);
List<Contingency> contingencies = contingenciesProvider.getContingencies(network);
DynamicSecurityAnalysisParameters parameters = runParameters.getDynamicSecurityAnalysisParameters();
SecurityAnalysisContext context = new SecurityAnalysisContext(network, workingVariantId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import com.powsybl.dynawo.security.ContingencyEventModels;
import com.powsybl.dynawo.security.SecurityAnalysisContext;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Objects;

Expand All @@ -26,7 +24,7 @@ public final class ContingenciesParXml {
private ContingenciesParXml() {
}

public static void write(Path workingDir, SecurityAnalysisContext context) throws IOException, XMLStreamException {
public static void write(Path workingDir, SecurityAnalysisContext context) {
Objects.requireNonNull(workingDir);
for (ContingencyEventModels model : context.getContingencyEventModels()) {
ParametersXml.write(model.eventParameters(), createParFileName(model), workingDir, DYN_PREFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.dynawo.security;

import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.config.MapModuleConfig;
import com.powsybl.dynawo.security.DynawoAlgorithmsConfig;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package xml;
package com.powsybl.dynawo.security.xml;

import com.powsybl.contingency.Contingency;
import com.powsybl.dynamicsimulation.DynamicSimulationParameters;
import com.powsybl.dynawaltz.DynaWaltzParameters;
import com.powsybl.dynawo.security.SecurityAnalysisContext;
import com.powsybl.dynawo.security.xml.ContingenciesDydXml;
import com.powsybl.dynawo.security.xml.ContingenciesParXml;
import com.powsybl.dynawaltz.xml.DynaWaltzTestUtil;
import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package xml;
package com.powsybl.dynawo.security.xml;

import com.powsybl.contingency.Contingency;
import com.powsybl.dynawaltz.DynaWaltzParameters;
import com.powsybl.dynawo.security.SecurityAnalysisContext;
import com.powsybl.dynawo.security.xml.MultipleJobsXml;
import com.powsybl.dynawaltz.xml.DynaWaltzConstants;
import com.powsybl.dynawaltz.xml.DynaWaltzTestUtil;
import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters;
Expand Down

0 comments on commit 84da059

Please sign in to comment.