Repository navigation
Report error on step execution #136
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
Changes from all commits
83d32ba
7453030
a3dfcfd
deb099c
b3bddbd
f0b67bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| monitor.worker.server.importCase = Import Case : ${caseName} | ||
| monitor.worker.server.loadflow.step.error = ${errorMessage} | ||
| monitor.worker.server.modifications.error = Some network composite modifications are missing : ${uuids} | ||
| monitor.worker.server.modifications.not.applied = Some network composite modifications are not applied intentionally (see process-config) : ${uuids} | ||
| monitor.worker.server.process = Process execution id : ${executionId} | ||
| monitor.worker.server.securityanalysis.step.error = ${errorMessage} | ||
| monitor.worker.server.shortcircuit.step.error = ${errorMessage} | ||
| monitor.worker.server.shortcircuit.step.error.VoltageLevelsWithWrongIscValuesSummarize = Some voltage levels have wrong isc values, isc min must be <= isc max: ${voltageLevels} | ||
| monitor.worker.server.step.error = ${errorMessage} | ||
| monitor.worker.server.stepType = ${stepType} |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some keys are not used anymore, like "monitor.worker.server.loadflow.step.error"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| monitor.worker.server.importCase = Import Case : ${caseName} | ||
| monitor.worker.server.loadflow.step.error = ${errorMessage} | ||
| monitor.worker.server.modifications.error = Some network composite modifications are missing : ${uuids} | ||
| monitor.worker.server.modifications.not.applied = Some network composite modifications are not applied intentionally (see process-config) : ${uuids} | ||
| monitor.worker.server.process = Process execution id : ${executionId} | ||
| monitor.worker.server.securityanalysis.step.error = ${errorMessage} | ||
| monitor.worker.server.shortcircuit.step.error = ${errorMessage} | ||
| monitor.worker.server.shortcircuit.step.error.VoltageLevelsWithWrongIscValuesSummarize = Some voltage levels have wrong isc values, isc min must be <= isc max: ${voltageLevels} | ||
| monitor.worker.server.step.error = ${errorMessage} | ||
| monitor.worker.server.stepType = ${stepType} |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename it ReportTestUtils ? I think in the future we'd rather have several utils class rather than a single one for all use cases
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /** | ||
| * Copyright (c) 2026, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * 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 org.gridsuite.monitor.worker.server.utils; | ||
|
|
||
| import com.powsybl.commons.report.ReportNode; | ||
| import org.apache.commons.text.StringSubstitutor; | ||
|
|
||
| /** | ||
| * @author Franck Lecuyer <franck.lecuyer at rte-france.com> | ||
| */ | ||
| public final class ReportTestUtils { | ||
| private ReportTestUtils() { | ||
| throw new IllegalCallerException("Utility class"); | ||
| } | ||
|
|
||
| public static boolean assertMessageFoundFromReporter(String expectedMessage, String reportKey, ReportNode reporterModel) { | ||
| StringSubstitutor reporterSubstitutor = new StringSubstitutor(reporterModel.getValues()); | ||
| return containsMessage(expectedMessage, reportKey, reporterModel, reporterSubstitutor); | ||
| } | ||
|
|
||
| private static boolean containsMessage(String expectedMessage, String reportKey, ReportNode reporter, StringSubstitutor reporterSubstitutor) { | ||
| for (ReportNode child : reporter.getChildren()) { | ||
| if (reportKey.equals(child.getMessageKey()) && expectedMessage.equals(formatReportMessage(child, reporterSubstitutor))) { | ||
| return true; | ||
| } | ||
| StringSubstitutor childSubstitutor = new StringSubstitutor(child.getValues()); | ||
| if (containsMessage(expectedMessage, reportKey, child, childSubstitutor)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| private static String formatReportMessage(ReportNode report, StringSubstitutor reporterSubstitutor) { | ||
| String reportMessage = new StringSubstitutor(report.getValues()).replace(report.getMessageTemplate()); | ||
| return reporterSubstitutor.replace(reportMessage).trim(); | ||
| } | ||
| } | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.