Skip to content

Commit

Permalink
Bump to powsybl-core 5.2.0 and to junit5 (#509)
Browse files Browse the repository at this point in the history
* Bump powsybl-core to 5.2.0
* Bump to junit5
* remove olf dependency from nad
* update test reference

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
  • Loading branch information
So-Fras authored Apr 4, 2023
1 parent 0c2f27b commit 1d431aa
Show file tree
Hide file tree
Showing 166 changed files with 1,996 additions and 2,110 deletions.
4 changes: 2 additions & 2 deletions diagram-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
*/
package com.powsybl.diagram.util.forcelayout;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class BoundingBoxTest {
class BoundingBoxTest {

@Test
public void test() {
void test() {
List<Point> points = new ArrayList<>();
points.add(new Point(1.0, 2.0));
points.add(new Point(3.0, 4.0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
*/
package com.powsybl.diagram.util.forcelayout;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class CanvasTest {
class CanvasTest {

@Test
public void test() {
void test() {
List<Point> points = new ArrayList<>();
points.add(new Point(1.0, 2.0));
points.add(new Point(3.0, 4.0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
*/
package com.powsybl.diagram.util.forcelayout;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class VectorTest {
class VectorTest {

@Test
public void test() {
void test() {
Vector vector = new Vector(1.0, 2.0);
assertEquals(2.24, vector.magnitude(), 0.01);
assertEquals(5.0, vector.magnitudeSquare(), 0.0);
Expand Down
14 changes: 2 additions & 12 deletions network-area-diagram/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -82,16 +82,6 @@
<artifactId>powsybl-config-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-loadflow-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-open-loadflow</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@
import com.powsybl.nad.svg.SvgParameters;
import com.powsybl.nad.svg.iidm.DefaultLabelProvider;
import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider;
import org.junit.Before;
import org.junit.Test;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.junit.Assert.assertEquals;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class NetworkAreaDiagramTest extends AbstractTest {
class NetworkAreaDiagramTest extends AbstractTest {

protected java.nio.file.FileSystem fileSystem;

@Before
public void setup() {
@BeforeEach
void setup() {
fileSystem = Jimfs.newFileSystem(Configuration.unix());
setLayoutParameters(new LayoutParameters());
setSvgParameters(new SvgParameters()
Expand Down Expand Up @@ -77,7 +77,7 @@ private String getContentFile(Path svgFile) {
}

@Test
public void testDrawSvg() {
void testDrawSvg() {
Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses();
NetworkAreaDiagram nad = new NetworkAreaDiagram(network, VoltageLevelFilter.NO_FILTER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
import com.powsybl.nad.model.Graph;
import com.powsybl.nad.model.Point;
import com.powsybl.nad.svg.NetworkTestFactory;
import org.junit.Test;

import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* @author Luma Zamarreno <zamarrenolm at aia.es>
*/
public class FixedLayoutTest {
class FixedLayoutTest {

@Test
public void testCurrentLimits() {
void testCurrentLimits() {
Network network = NetworkTestFactory.createTwoVoltageLevels();

Map<String, Point> expected = Map.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
import com.powsybl.nad.svg.SvgParameters;
import com.powsybl.nad.svg.iidm.DefaultLabelProvider;
import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;

/**
* @author Luma Zamarreno <zamarrenolm at aia.es>
*/
public class ForceLayoutTest extends AbstractTest {
class ForceLayoutTest extends AbstractTest {

@Before
public void setup() {
@BeforeEach
void setup() {
setLayoutParameters(new LayoutParameters().setTextNodesForceLayout(false));
setSvgParameters(new SvgParameters()
.setInsertNameDesc(false)
Expand All @@ -42,14 +42,14 @@ protected LabelProvider getLabelProvider(Network network) {
}

@Test
public void testDiamondNoSpringRepulsionFactor() {
void testDiamondNoSpringRepulsionFactor() {
assertEquals(
toString("/diamond-spring-repulsion-factor-0.0.svg"),
generateSvgString(LayoutNetworkFactory.createDiamond(), "/diamond-spring-repulsion-factor-0.0.svg"));
}

@Test
public void testDiamondSmallSpringRepulsionFactor() {
void testDiamondSmallSpringRepulsionFactor() {
getLayoutParameters().setSpringRepulsionFactorForceLayout(0.2);
assertEquals(
toString("/diamond-spring-repulsion-factor-0.2.svg"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author Luma Zamarreno <zamarrenolm at aia.es>
*/
public final class LayoutNetworkFactory {
final class LayoutNetworkFactory {

private LayoutNetworkFactory() {
// Empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
*/
package com.powsybl.nad.layout;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Florian Dupuy <florian.dupuy at rte-france.com>
*/
public class LayoutParametersTest {
class LayoutParametersTest {

@Test
public void test() {
void test() {
LayoutParameters layoutParameters0 = new LayoutParameters()
.setTextNodesForceLayout(true)
.setSpringRepulsionFactorForceLayout(1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,26 @@
import com.powsybl.nad.svg.SvgParameters;
import com.powsybl.nad.svg.iidm.DefaultLabelProvider;
import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.StringWriter;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;

import static org.junit.Assert.*;

/**
* @author Luma Zamarreno <zamarrenolm at aia.es>
*/
public class LayoutWithInitialPositionsTest extends AbstractTest {
class LayoutWithInitialPositionsTest extends AbstractTest {

@Before
public void setup() {
@BeforeEach
void setup() {
setLayoutParameters(new LayoutParameters());
setSvgParameters(new SvgParameters()
.setInsertNameDesc(true)
Expand All @@ -55,12 +57,12 @@ protected LabelProvider getLabelProvider(Network network) {
}

@Test
public void testDiamond() {
void testDiamond() {
checkLayoutWithInitialPositions(LayoutNetworkFactory.createDiamond());
}

@Test
public void testNbVoltageLevels() {
void testNbVoltageLevels() {
Network network = LayoutNetworkFactory.createDiamond();

assertEquals(1, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 0).getNbVoltageLevels());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
import com.powsybl.nad.layout.LayoutParameters;
import com.powsybl.nad.svg.iidm.DefaultLabelProvider;
import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Luma Zamarreño <zamarrenolm at aia.es>
*/
public class DanglingLineTest extends AbstractTest {
class DanglingLineTest extends AbstractTest {

@Before
public void setup() {
@BeforeEach
void setup() {
setLayoutParameters(new LayoutParameters());
setSvgParameters(new SvgParameters()
.setSvgWidthAndHeightAdded(true)
Expand All @@ -42,13 +41,13 @@ protected LabelProvider getLabelProvider(Network network) {
}

@Test
public void testConnected() {
void testConnected() {
Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses();
assertEquals(toString("/dangling_line_connected.svg"), generateSvgString(network, "/dangling_line_connected.svg"));
}

@Test
public void testDisconnected() {
void testDisconnected() {
Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses();
network.getDanglingLines().iterator().next().getTerminal().disconnect();
assertEquals(toString("/dangling_line_disconnected.svg"), generateSvgString(network, "/dangling_line_disconnected.svg"));
Expand Down
Loading

0 comments on commit 1d431aa

Please sign in to comment.