Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support writing IIDM-XML network extensions in previous versions #1138

Merged
merged 13 commits into from
Feb 25, 2020

Conversation

miovd
Copy link
Contributor

@miovd miovd commented Jan 31, 2020

Signed-off-by: RALAMBOTIANA MIORA miora.ralambotiana@rte-france.com

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

What is the current behavior? (You can also link to an open issue here)
Network extensions can only be serialized in their latest version.

What is the new behavior (if this is a feature change)?
A user can choose the version in which they want to serialize their network extensions.

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
No

@miovd miovd added this to PR in progress in Evolutions IIDM via automation Jan 31, 2020
@miovd miovd changed the title [WIP] Support writing IIDM-XML network extensions in previous versions Support writing IIDM-XML network extensions in previous versions Feb 3, 2020
@miovd miovd requested a review from mathbagu February 3, 2020 10:10
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd force-pushed the write_network_ext_versioning branch from 7b9569c to 3bcf990 Compare February 17, 2020 12:32
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
@mathbagu
Copy link
Contributor

Could please add:

  • a method in the Context to get the version for an extension (String getExtensionVersion(String name);)
  • an example of configuration where you specify the version for a specific extension (what happen if the version is not supported by the serializer ?)

…on exists before writing

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd requested a review from mathbagu February 20, 2020 16:35
Copy link
Contributor

@mathbagu mathbagu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like a second reviewer on this PR

Copy link

@agnesLeroy agnesLeroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MioRtia thanks for your work on this PR! Overall it looks good to me. I've just left comments when I didn't understand what you did.

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
public void testThrowErrorUncompatibleExtensionVersion() {
public void testNotLatestVersionTerminalExtension() throws IOException {
// import XIIDM file with loadMock v1.2
Network network = NetworkXml.read(getClass().getResourceAsStream("/V1_1/eurostag-tutorial-example1-with-loadMockExt-1_2.xml"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you use getVersionDir(IidmXmlVersion.V1_1) also there?

Maybe we should introduce a method somewhere to get a network resource based on a version and a filename:

InputStream getNetworkAsStream(String filename, IidmVersion version) {
    return getClass().getResourceAsStream(version + "/" + filename);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will make the change you suggested and introduce the new method in a new PR to prevent confusion in this one.

@sonarcloud
Copy link

sonarcloud bot commented Feb 25, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

83.9% 83.9% Coverage
0.0% 0.0% Duplication

@miovd miovd merged commit 4b40132 into master Feb 25, 2020
Evolutions IIDM automation moved this from PR in progress to Merged PR Feb 25, 2020
@miovd miovd deleted the write_network_ext_versioning branch February 25, 2020 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Evolutions IIDM
  
Merged PR
Development

Successfully merging this pull request may close these issues.

None yet

3 participants