Skip to content

Commit 9416a75

Browse files
authored
Merge branch 'main' into add-locationId-to-sa-result
2 parents 68415ca + 4a2f188 commit 9416a75

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
<dependencyManagement>
9090
<dependencies>
9191
<!-- overrides of imports -->
92+
<dependency><!-- To remove when integrate in next release of gridsuite-dependencies or powsybl-ws-dependencies -->
93+
<groupId>com.powsybl</groupId>
94+
<artifactId>powsybl-ws-commons</artifactId>
95+
<version>1.19.0</version>
96+
</dependency>
9297
<dependency><!-- To remove when integrate in next release of gridsuite-dependencies or powsybl-ws-dependencies -->
9398
<groupId>com.squareup.okhttp3</groupId>
9499
<artifactId>okhttp-bom</artifactId>

src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ public SecurityAnalysisResult run(SecurityAnalysisRunContext runContext) {
105105
runContext.setNetwork(network);
106106
AtomicReference<ReportNode> rootReporter = new AtomicReference<>();
107107
return run(runContext, null, rootReporter);
108-
} catch (InterruptedException e) {
109-
Thread.currentThread().interrupt();
110-
return null;
111108
} catch (Exception e) {
112109
LOGGER.error(getFailedMessage(getComputationType()), e);
113110
return null;

src/main/resources/config/application.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
spring:
22
application:
33
name: security-analysis-server
4-
4+
55
jpa:
66
properties:
77
hibernate:
@@ -20,6 +20,7 @@ spring:
2020
group: saGroup
2121
consumer:
2222
concurrency: 2
23+
max-attempts: 1
2324
publishRun-out-0:
2425
destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.run
2526
publishResult-out-0:
@@ -30,11 +31,21 @@ spring:
3031
destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.cancel
3132
publishStopped-out-0:
3233
destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.stopped
33-
publishFailed-out-0:
34-
destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.failed
3534
publishCancelFailed-out-0:
3635
destination: ${powsybl-ws.rabbitmq.destination.prefix:}sa.cancelfailed
37-
output-bindings: publishRun-out-0;publishResult-out-0;publishCancel-out-0;publishStopped-out-0;publishFailed-out-;publishCancelFailed-out-0
36+
output-bindings: publishRun-out-0;publishResult-out-0;publishCancel-out-0;publishStopped-out-0;publishCancelFailed-out-0
37+
rabbit:
38+
bindings:
39+
consumeRun-in-0:
40+
consumer:
41+
auto-bind-dlq: true
42+
dead-letter-exchange: ${powsybl-ws.rabbitmq.destination.prefix:}sa.run.dlx
43+
dead-letter-queue-name: ${powsybl-ws.rabbitmq.destination.prefix:}sa.run.dlx.dlq
44+
dead-letter-exchange-type: topic
45+
quorum:
46+
enabled: true
47+
delivery-limit: 2
48+
3849

3950
powsybl-ws:
4051
database:
@@ -93,4 +104,4 @@ security-analysis:
93104
- [ 1, 1, 1, 1, 1, 1 ]
94105
- [ 1, 1, 1, 1, 1, 1 ]
95106
- [ 1, 1, 0.95, 0.95, 0.9, 0.9 ]
96-
- [ 1, 1, 0.95, 0.95, 0.9, 0.9 ]
107+
- [ 1, 1, 0.95, 0.95, 0.9, 0.9 ]

src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisControllerTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import static org.gridsuite.securityanalysis.server.util.TestUtils.assertLogMessage;
7676
import static org.hamcrest.MatcherAssert.assertThat;
7777
import static org.junit.jupiter.api.Assertions.assertEquals;
78+
import static org.junit.jupiter.api.Assertions.assertNull;
7879
import static org.mockito.ArgumentMatchers.any;
7980
import static org.mockito.BDDMockito.given;
8081
import static org.mockito.Mockito.doNothing;
@@ -673,11 +674,8 @@ void runTestWithError() throws Exception {
673674
UUID resultUuid = mapper.readValue(resultAsString, UUID.class);
674675
assertEquals(RESULT_UUID, resultUuid);
675676

676-
// Message stopped has been sent
677-
Message<byte[]> cancelMessage = output.receive(TIMEOUT, "sa.failed");
678-
assertEquals(RESULT_UUID.toString(), cancelMessage.getHeaders().get("resultUuid"));
679-
assertEquals("me", cancelMessage.getHeaders().get("receiver"));
680-
assertEquals(getFailedMessage(COMPUTATION_TYPE) + " : " + ERROR_MESSAGE, cancelMessage.getHeaders().get("message"));
677+
// No result message
678+
assertNull(output.receive(TIMEOUT, "sa.result"));
681679

682680
// No result
683681
assertResultNotFound(RESULT_UUID);

0 commit comments

Comments
 (0)