Skip to content

Commit

Permalink
Update powsybl-core dependency to 6.5.0 (#160)
Browse files Browse the repository at this point in the history
* bump powsybl-core dependency to 6.5.0

Signed-off-by: Nicolas Rol <[email protected]>

* add test to cover isDataExtension method on AppStorageDataSource

Signed-off-by: Nicolas Rol <[email protected]>

---------

Signed-off-by: Nicolas Rol <[email protected]>
  • Loading branch information
rolnico authored Oct 28, 2024
1 parent ca478ae commit e899075
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
27 changes: 14 additions & 13 deletions afs-core/src/test/java/com/powsybl/afs/AppFileSystemToolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.nio.file.Path;
import java.util.Collections;
import java.util.UUID;
import java.util.regex.Pattern;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand All @@ -31,7 +32,7 @@
*/
class AppFileSystemToolTest extends AbstractToolTest {

private AppFileSystemTool tool;
private final AppFileSystemTool tool;

private static final String FOLDER_PSEUDO_CLASS = "folder";

Expand All @@ -41,14 +42,14 @@ public AppFileSystemToolTest() {
@Override
protected AppData createAppData(ToolRunningContext context) {
AppData appData = new AppData(computationManager, computationManager, Collections.emptyList(),
Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
AppStorage storage = MapDbAppStorage.createMem("mem", appData.getEventsBus());
AppFileSystem afs = new AppFileSystem("mem", false, storage);
appData.addFileSystem(afs);
afs.getRootFolder().createProject("test_project1");
afs.getRootFolder().createProject("test_project2");
storage.createNode(afs.getRootFolder().getId(), "test", FOLDER_PSEUDO_CLASS, "", 0,
new NodeGenericMetadata().setString("k", "v"));
new NodeGenericMetadata().setString("k", "v"));
storage.flush();
return appData;
}
Expand Down Expand Up @@ -93,25 +94,25 @@ void testLs() {

@Test
void testLsInconsistentNodes() {
assertCommandMatchTextOrRegex(new String[] {"afs", "--ls-inconsistent-nodes", "mem"}, 0, "mem:"
+ System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator(), "");
assertCommandMatchTextOrRegex(new String[] {"afs", "--ls-inconsistent-nodes"}, 0, "mem:"
+ System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator(), "");
assertCommandSuccessfulRegex(new String[] {"afs", "--ls-inconsistent-nodes", "mem"},
Pattern.compile("mem:" + System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator()));
assertCommandSuccessfulRegex(new String[] {"afs", "--ls-inconsistent-nodes"},
Pattern.compile("mem:" + System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator()));
}

@Test
void testFixInconsistentNodes() {
assertCommandMatchTextOrRegex(new String[] {"afs", "--fix-inconsistent-nodes", "mem"}, 0, "mem:"
+ System.lineSeparator() + "[a-z0-9-]+ fixed", "");
assertCommandSuccessfulRegex(new String[] {"afs", "--fix-inconsistent-nodes", "mem"},
Pattern.compile("mem:" + System.lineSeparator() + "[a-z0-9-]+ fixed"));
assertCommandErrorMatch(new String[] {"afs", "--fix-inconsistent-nodes"}, 3, "IllegalArgumentException");
assertCommandMatchTextOrRegex(new String[] {"afs", "--ls-inconsistent-nodes", "mem", "nodeId"}, 0, "mem:"
+ System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator(), "");
assertCommandSuccessfulRegex(new String[] {"afs", "--ls-inconsistent-nodes", "mem", "nodeId"},
Pattern.compile("mem:" + System.lineSeparator() + "[a-z0-9-]+" + System.lineSeparator()));
}

@Test
void testRemoveInconsistentNodes() {
assertCommandMatchTextOrRegex(new String[] {"afs", "--rm-inconsistent-nodes", "mem"}, 0, "mem:"
+ System.lineSeparator() + "[a-z0-9-]+ cleaned", "");
assertCommandSuccessfulRegex(new String[] {"afs", "--rm-inconsistent-nodes", "mem"},
Pattern.compile("mem:" + System.lineSeparator() + "[a-z0-9-]+ cleaned"));
assertCommandErrorMatch(new String[] {"afs", "--rm-inconsistent-nodes"}, 3, "IllegalArgumentException");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,6 @@ void test() {
assertEquals("Test format", case1.get().getDescription());
DataSource ds = new AppStorageDataSource(storage, case1.get().getId(), case1.get().getName());
assertNotNull(ds);
assertTrue(ds.isDataExtension("foo"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ public String getBaseName() {
return nodeName;
}

/**
* {@inheritDoc}
* @return true
*/
@Override
public boolean isDataExtension(String ext) {
return true;
}

@Override
public OutputStream newOutputStream(final String suffix, final String ext, boolean append) {
if (append) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<testcontainers.version>1.20.1</testcontainers.version>
<tyrus.version>2.1.5</tyrus.version>

<powsyblcore.version>6.4.1</powsyblcore.version>
<powsyblcore.version>6.5.0</powsyblcore.version>

<!-- Parameters used to generate the javadoc for groovy and java classes.
See the pom file in powsybl-parent for more explanations. -->
Expand Down

0 comments on commit e899075

Please sign in to comment.