Skip to content

Commit 258b6b2

Browse files
authored
First implementation for gridsuite-computation common lib (#1)
Signed-off-by: Rehili Ghazwa <[email protected]>
1 parent a09d5f6 commit 258b6b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4418
-1
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
uses: powsybl/github-ci/.github/workflows/build-backend-lib-generic.yml@39565de6fd7d394ed76fa09e5197ffb1350ff1e6
12+
with:
13+
eventType: computation_updated
14+
secrets:
15+
sonar-token: ${{ secrets.SONAR_TOKEN }}
16+
repo-token: ${{ secrets.REPO_ACCESS_TOKEN }}

.github/workflows/patch.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Patch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branchRef:
7+
description: 'Patch branch (format: release-vX.Y.Z)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
run-patch:
13+
uses: powsybl/github-ci/.github/workflows/patch-backend-lib-generic.yml@39565de6fd7d394ed76fa09e5197ffb1350ff1e6
14+
with:
15+
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
16+
branchRef: ${{ github.event.inputs.branchRef }}
17+
secrets:
18+
VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionType:
7+
description: 'Version type increment (major | minor)'
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
14+
jobs:
15+
run-release:
16+
uses: powsybl/github-ci/.github/workflows/release-backend-lib-generic.yml@39565de6fd7d394ed76fa09e5197ffb1350ff1e6
17+
with:
18+
githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
19+
versionType: ${{ github.event.inputs.versionType }}
20+
secrets:
21+
VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# VSCode
2+
/.vscode
3+
/.settings
4+
.classpath
5+
.factorypath
6+
.project
7+
8+
target/
9+
10+
# IntelliJ
11+
/.idea
12+
*.iml

.mvn/lombok-config-copy.marker

Whitespace-only changes.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
# computation
1+
# computation
2+
3+
[![Actions Status](https://github.com/gridsuite/computation/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/gridsuite/computation/actions)
4+
[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=org.gridsuite%3Acomputation&metric=coverage)](https://sonarcloud.io/component_measures?id=org.gridsuite%3Acomputation&metric=coverage)
5+
[![MPL-2.0 License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/)
6+
7+
Common library for computation and result filtering.

lombok.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import target/configs/powsybl-build-tools.jar!powsybl-build-tools/lombok.config

pom.xml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (c) 2025, RTE (http://www.rte-france.com)
4+
This Source Code Form is subject to the terms of the Mozilla Public
5+
License, v. 2.0. If a copy of the MPL was not distributed with this
6+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
-->
8+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
9+
xmlns="http://maven.apache.org/POM/4.0.0"
10+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<parent>
14+
<groupId>com.powsybl</groupId>
15+
<artifactId>powsybl-parent</artifactId>
16+
<version>23</version>
17+
<relativePath/>
18+
</parent>
19+
20+
<groupId>org.gridsuite</groupId>
21+
<artifactId>gridsuite-computation</artifactId>
22+
<version>1.0.0-SNAPSHOT</version>
23+
24+
<packaging>jar</packaging>
25+
<name>Computation library</name>
26+
<description>Common library for common computation and result filtering.</description>
27+
<url>http://www.gridsuite.org/</url>
28+
29+
<scm>
30+
<connection>scm:git:https://github.com/gridsuite/computation.git</connection>
31+
<developerConnection>scm:git:https://github.com/gridsuite/computation.git</developerConnection>
32+
<url>https://github.com/gridsuite/computation</url>
33+
</scm>
34+
35+
<developers>
36+
<developer>
37+
<name>Rehili Ghazwa</name>
38+
<email>[email protected]</email>
39+
<organization>RTE</organization>
40+
<organizationUrl>http://www.rte-france.com</organizationUrl>
41+
</developer>
42+
</developers>
43+
44+
<properties>
45+
<powsybl-ws-dependencies.version>2.23.0</powsybl-ws-dependencies.version>
46+
<gridsuite-filter.version>1.6.0</gridsuite-filter.version>
47+
48+
<org-apache-commons.version>4.4</org-apache-commons.version>
49+
<org.hamcrest.version>2.2</org.hamcrest.version>
50+
51+
<sonar.organization>gridsuite</sonar.organization>
52+
<sonar.projectKey>org.gridsuite:computation</sonar.projectKey>
53+
</properties>
54+
55+
<build>
56+
<pluginManagement>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-surefire-plugin</artifactId>
61+
</plugin>
62+
</plugins>
63+
</pluginManagement>
64+
<plugins>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-failsafe-plugin</artifactId>
68+
</plugin>
69+
</plugins>
70+
</build>
71+
72+
<dependencyManagement>
73+
<dependencies>
74+
<!-- Import -->
75+
<dependency>
76+
<groupId>com.powsybl</groupId>
77+
<artifactId>powsybl-ws-dependencies</artifactId>
78+
<version>${powsybl-ws-dependencies.version}</version>
79+
<type>pom</type>
80+
<scope>import</scope>
81+
</dependency>
82+
</dependencies>
83+
</dependencyManagement>
84+
85+
<dependencies>
86+
<!-- ============================================= -->
87+
<!-- COMPILATION DEPENDENCIES -->
88+
<!-- ============================================= -->
89+
<!-- Apache Commons -->
90+
<dependency>
91+
<groupId>org.apache.commons</groupId>
92+
<artifactId>commons-collections4</artifactId>
93+
</dependency>
94+
95+
<!-- Jackson -->
96+
<dependency>
97+
<groupId>com.fasterxml.jackson.core</groupId>
98+
<artifactId>jackson-databind</artifactId>
99+
</dependency>
100+
101+
<!-- Jakarta APIs -->
102+
<dependency>
103+
<groupId>jakarta.validation</groupId>
104+
<artifactId>jakarta.validation-api</artifactId>
105+
</dependency>
106+
<dependency>
107+
<groupId>jakarta.persistence</groupId>
108+
<artifactId>jakarta.persistence-api</artifactId>
109+
</dependency>
110+
111+
<!-- Spring Framework -->
112+
<dependency>
113+
<groupId>org.springframework</groupId>
114+
<artifactId>spring-core</artifactId>
115+
</dependency>
116+
<dependency>
117+
<groupId>org.springframework</groupId>
118+
<artifactId>spring-messaging</artifactId>
119+
</dependency>
120+
121+
<!-- Spring Data -->
122+
<dependency>
123+
<groupId>org.springframework.data</groupId>
124+
<artifactId>spring-data-jpa</artifactId>
125+
</dependency>
126+
127+
<!-- Spring Cloud -->
128+
<dependency>
129+
<groupId>org.springframework.cloud</groupId>
130+
<artifactId>spring-cloud-stream</artifactId>
131+
</dependency>
132+
133+
<!-- AspectJ -->
134+
<dependency>
135+
<groupId>org.aspectj</groupId>
136+
<artifactId>aspectjweaver</artifactId>
137+
<optional>true</optional>
138+
</dependency>
139+
140+
<!-- Micrometer -->
141+
<dependency>
142+
<groupId>io.micrometer</groupId>
143+
<artifactId>micrometer-core</artifactId>
144+
<optional>true</optional>
145+
</dependency>
146+
147+
<!-- Powsybl -->
148+
<dependency>
149+
<groupId>com.powsybl</groupId>
150+
<artifactId>powsybl-network-store-client</artifactId>
151+
<optional>true</optional>
152+
</dependency>
153+
<dependency>
154+
<groupId>com.powsybl</groupId>
155+
<artifactId>powsybl-security-analysis-api</artifactId>
156+
<optional>true</optional>
157+
</dependency>
158+
159+
<!-- GridSuite -->
160+
<dependency>
161+
<groupId>org.gridsuite</groupId>
162+
<artifactId>gridsuite-filter</artifactId>
163+
<version>${gridsuite-filter.version}</version>
164+
</dependency>
165+
166+
<!-- ============================================= -->
167+
<!-- PROVIDED DEPENDENCIES -->
168+
<!-- ============================================= -->
169+
170+
<dependency>
171+
<groupId>org.projectlombok</groupId>
172+
<artifactId>lombok</artifactId>
173+
<scope>provided</scope>
174+
</dependency>
175+
176+
<!-- ============================================= -->
177+
<!-- TEST DEPENDENCIES -->
178+
<!-- ============================================= -->
179+
180+
<!-- JUnit -->
181+
<dependency>
182+
<groupId>org.junit.jupiter</groupId>
183+
<artifactId>junit-jupiter</artifactId>
184+
<scope>test</scope>
185+
</dependency>
186+
187+
<!-- Mockito -->
188+
<dependency>
189+
<groupId>org.mockito</groupId>
190+
<artifactId>mockito-core</artifactId>
191+
<scope>test</scope>
192+
</dependency>
193+
<dependency>
194+
<groupId>org.mockito</groupId>
195+
<artifactId>mockito-junit-jupiter</artifactId>
196+
<scope>test</scope>
197+
</dependency>
198+
199+
<!-- AssertJ -->
200+
<dependency>
201+
<groupId>org.assertj</groupId>
202+
<artifactId>assertj-core</artifactId>
203+
<scope>test</scope>
204+
</dependency>
205+
206+
<!-- Hamcrest -->
207+
<dependency>
208+
<groupId>org.hamcrest</groupId>
209+
<artifactId>hamcrest</artifactId>
210+
<version>${org.hamcrest.version}</version>
211+
<scope>test</scope>
212+
</dependency>
213+
214+
<!-- JSON Assert -->
215+
<dependency>
216+
<groupId>org.skyscreamer</groupId>
217+
<artifactId>jsonassert</artifactId>
218+
<scope>test</scope>
219+
</dependency>
220+
221+
<!-- Spring Boot Test -->
222+
<dependency>
223+
<groupId>org.springframework.boot</groupId>
224+
<artifactId>spring-boot-test-autoconfigure</artifactId>
225+
<scope>test</scope>
226+
</dependency>
227+
</dependencies>
228+
</project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.computation;
8+
9+
import com.fasterxml.jackson.databind.InjectableValues;
10+
import com.powsybl.commons.report.ReportNodeDeserializer;
11+
import com.powsybl.commons.report.ReportNodeJsonModule;
12+
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
13+
import org.springframework.context.annotation.Bean;
14+
import org.springframework.context.annotation.Configuration;
15+
16+
@Configuration
17+
public class ComputationConfig {
18+
@Bean
19+
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
20+
return builder -> builder.modulesToInstall(new ReportNodeJsonModule())
21+
.postConfigurer(objMapper -> objMapper.setInjectableValues(new InjectableValues.Std().addValue(ReportNodeDeserializer.DICTIONARY_VALUE_ID, null)));
22+
}
23+
}

0 commit comments

Comments
 (0)