Skip to content

Commit 892cfdc

Browse files
committed
update dependencies
1 parent a63b447 commit 892cfdc

35 files changed

+512
-280
lines changed

pom.xml

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>fr.istic</groupId>
56
<artifactId>correctexam</artifactId>
@@ -37,9 +38,9 @@
3738
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
3839
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
3940
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
40-
<quarkus-plugin.version>3.25.4</quarkus-plugin.version>
41+
<quarkus-plugin.version>3.30.5</quarkus-plugin.version>
4142
<quarkus.logManager>org.jboss.logmanager.LogManager</quarkus.logManager>
42-
<quarkus.platform.version>3.25.4</quarkus.platform.version>
43+
<quarkus.platform.version>3.30.5</quarkus.platform.version>
4344
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
4445
</properties>
4546
<dependencyManagement>
@@ -55,31 +56,31 @@
5556
</dependencyManagement>
5657
<dependencies>
5758

58-
<dependency>
59+
<dependency>
5960
<groupId>org.apache.pdfbox</groupId>
6061
<artifactId>pdfbox</artifactId>
6162
<version>3.0.5</version>
6263
</dependency>
6364
<!-- https://mvnrepository.com/artifact/io.quarkus/quarkus-awt -->
64-
<dependency>
65-
<groupId>io.quarkus</groupId>
66-
<artifactId>quarkus-awt</artifactId>
67-
</dependency>
65+
<dependency>
66+
<groupId>io.quarkus</groupId>
67+
<artifactId>quarkus-awt</artifactId>
68+
</dependency>
6869
<!-- https://mvnrepository.com/artifact/org.apache.camel.quarkus/camel-quarkus-pdf -->
69-
<!--<dependency>
70+
<!--<dependency>
7071
<groupId>org.apache.camel.quarkus</groupId>
7172
<artifactId>camel-quarkus-pdf</artifactId>
7273
<version>3.6.0</version>
7374
</dependency>-->
7475

7576

76-
<dependency>
77-
<groupId>io.quarkiverse.minio</groupId>
78-
<artifactId>quarkus-minio</artifactId>
79-
<version>3.8.4</version>
80-
</dependency>
81-
8277
<dependency>
78+
<groupId>io.quarkiverse.minio</groupId>
79+
<artifactId>quarkus-minio</artifactId>
80+
<version>3.8.6</version>
81+
</dependency>
82+
83+
<!-- <dependency>
8384
<groupId>io.quarkus</groupId>
8485
<artifactId>quarkus-resteasy</artifactId>
8586
</dependency>
@@ -93,8 +94,8 @@
9394
</dependency>
9495
<dependency>
9596
<groupId>io.quarkus</groupId>
96-
<artifactId>quarkus-resteasy-jsonb</artifactId>
97-
</dependency>
97+
<artifactId>quarkus-resteasy-jackson</artifactId>
98+
</dependency>-->
9899
<dependency>
99100
<groupId>io.quarkus</groupId>
100101
<artifactId>quarkus-mailer</artifactId>
@@ -115,17 +116,30 @@
115116
<groupId>io.quarkus</groupId>
116117
<artifactId>quarkus-security</artifactId>
117118
</dependency>
119+
<dependency>
120+
<groupId>io.quarkus</groupId>
121+
<artifactId>quarkus-rest</artifactId>
122+
</dependency>
123+
<dependency>
124+
<groupId>io.quarkus</groupId>
125+
<artifactId>quarkus-rest-jackson</artifactId>
126+
</dependency>
127+
118128
<dependency>
119129
<groupId>io.quarkus</groupId>
120130
<artifactId>quarkus-test-h2</artifactId>
121131
<scope>test</scope>
122132
</dependency>
123133
<dependency>
134+
<groupId>io.quarkus</groupId>
135+
<artifactId>quarkus-messaging-rabbitmq</artifactId>
136+
</dependency>
137+
<!-- <dependency>
124138
<groupId>org.ow2.asm</groupId>
125139
<artifactId>asm</artifactId>
126140
<version>9.7.1</version>
127141
<scope>test</scope>
128-
</dependency>
142+
</dependency>-->
129143
<dependency>
130144
<groupId>io.quarkus</groupId>
131145
<artifactId>quarkus-liquibase</artifactId>
@@ -177,6 +191,7 @@
177191
<groupId>org.mapstruct</groupId>
178192
<artifactId>mapstruct-processor</artifactId>
179193
<version>${mapstruct.version}</version>
194+
180195
<scope>provided</scope>
181196
</dependency>
182197
<dependency>
@@ -187,13 +202,12 @@
187202
<dependency>
188203
<groupId>io.quarkus</groupId>
189204
<artifactId>quarkus-junit5-mockito</artifactId>
190-
191205
<scope>test</scope>
192206
</dependency>
193207
<dependency>
194208
<groupId>io.rest-assured</groupId>
195209
<artifactId>rest-assured</artifactId>
196-
<version>5.5.6</version>
210+
<version>5.5.6</version>
197211
<scope>test</scope>
198212
</dependency>
199213
<dependency>
@@ -208,6 +222,14 @@
208222
<version>${archunit-junit5.version}</version>
209223
<scope>test</scope>
210224
</dependency>
225+
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
226+
227+
<!--<dependency>
228+
<groupId>org.jasig.cas.client</groupId>
229+
<artifactId>cas-client-core</artifactId>
230+
<version>${cas.version}</version>
231+
</dependency>-->
232+
<!-- https://mvnrepository.com/artifact/org.apereo.cas.client/cas-client-core -->
211233
<dependency>
212234
<groupId>com.tngtech.archunit</groupId>
213235
<artifactId>archunit-junit5-engine</artifactId>
@@ -221,20 +243,13 @@
221243
<classifier>runtime</classifier>
222244
<scope>test</scope>
223245
</dependency>
224-
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
246+
<dependency>
247+
<groupId>io.quarkiverse.jdbc</groupId>
248+
<artifactId>quarkus-jdbc-sqlite</artifactId>
249+
<version>3.0.11</version>
250+
</dependency>
225251

226-
<!--<dependency>
227-
<groupId>org.jasig.cas.client</groupId>
228-
<artifactId>cas-client-core</artifactId>
229-
<version>${cas.version}</version>
230-
</dependency>-->
231-
<!-- https://mvnrepository.com/artifact/org.apereo.cas.client/cas-client-core -->
232-
<dependency>
233-
<groupId>io.quarkiverse.jdbc</groupId>
234-
<artifactId>quarkus-jdbc-sqlite</artifactId>
235-
<version>3.0.11</version>
236-
</dependency>
237-
<!-- <dependency>
252+
<!-- <dependency>
238253
<groupId>org.apereo.cas.client</groupId>
239254
<artifactId>cas-client-core</artifactId>
240255
<version>4.0.4</version>
@@ -375,9 +390,9 @@
375390
<version>${maven-surefire-plugin.version}</version>
376391
<configuration>
377392
<systemPropertyVariables>
378-
<!-- <jacoco-agent.destfile>${jacoco.utReportFile}</jacoco-agent.destfile>-->
393+
<!-- <jacoco-agent.destfile>${jacoco.utReportFile}</jacoco-agent.destfile>-->
379394
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
380-
<maven.home>${maven.home}</maven.home>
395+
<maven.home>${maven.home}</maven.home>
381396

382397
</systemPropertyVariables>
383398
</configuration>
@@ -437,13 +452,13 @@
437452
<artifactId>liquibase-maven-plugin</artifactId>
438453
<version>4.31.1</version>
439454
<configuration>
440-
<changeLogFile>config/liquibase/master.xml</changeLogFile>
441-
<changeLogDirectory>${project.basedir}/src/main/resources/</changeLogDirectory>
455+
<changeLogFile>config/liquibase/master.xml</changeLogFile>
456+
<changeLogDirectory>${project.basedir}/src/main/resources/</changeLogDirectory>
442457

443-
<url>jdbc:mysql://localhost:3306/gradeScopeIstic</url>
444-
<username>tlc</username>
445-
<password>tlc</password>
446-
</configuration>
458+
<url>jdbc:mysql://localhost:3306/gradeScopeIstic</url>
459+
<username>tlc</username>
460+
<password>tlc</password>
461+
</configuration>
447462
</plugin>
448463

449464
<plugin>
@@ -632,7 +647,7 @@
632647
</dependencies>
633648
<build>
634649
<plugins>
635-
<!-- <plugin>
650+
<!-- <plugin>
636651
<groupId>org.cyclonedx</groupId>
637652
<artifactId>cyclonedx-maven-plugin</artifactId>
638653
<configuration>

src/main/java/fr/istic/config/FooDeserializer.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/java/fr/istic/config/FooSerializer.java

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
package fr.istic.config;
2+
3+
4+
import jakarta.inject.Singleton;
5+
6+
import java.io.IOException;
7+
import java.time.LocalDateTime;
8+
import java.time.OffsetDateTime;
9+
import java.time.ZoneOffset;
10+
import java.time.format.DateTimeFormatter;
11+
import java.util.Base64;
12+
13+
import com.fasterxml.jackson.annotation.JsonInclude;
14+
import com.fasterxml.jackson.core.JsonGenerator;
15+
import com.fasterxml.jackson.core.JsonParser;
16+
import com.fasterxml.jackson.databind.DeserializationContext;
17+
import com.fasterxml.jackson.databind.DeserializationFeature;
18+
import com.fasterxml.jackson.databind.JsonDeserializer;
19+
import com.fasterxml.jackson.databind.JsonSerializer;
20+
import com.fasterxml.jackson.databind.ObjectMapper;
21+
import com.fasterxml.jackson.databind.SerializationFeature;
22+
import com.fasterxml.jackson.databind.SerializerProvider;
23+
import com.fasterxml.jackson.databind.module.SimpleModule;
24+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
25+
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
26+
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
27+
28+
import io.quarkus.jackson.ObjectMapperCustomizer;
29+
30+
31+
@Singleton
32+
public class JsonConfiguration implements ObjectMapperCustomizer {
33+
34+
@Override
35+
public void customize(ObjectMapper objectMapper) {
36+
// TODO Auto-generated method stub
37+
var module = new SimpleModule();
38+
module.addDeserializer(byte[].class, new CustomByteDeserializer());
39+
module.addSerializer(new CustomByteSerializer());
40+
objectMapper.registerModule(module);
41+
42+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT);
43+
44+
// On utilise le module officiel JavaTimeModule pour surcharger LocalDateTime
45+
JavaTimeModule javaTimeModule = new JavaTimeModule();
46+
47+
// Sérialisation (Java -> JSON String)
48+
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter));
49+
50+
// Désérialisation (JSON String -> Java)
51+
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
52+
53+
// Enregistrement du module
54+
objectMapper.registerModule(javaTimeModule);
55+
56+
57+
// IMPORTANT : Désactiver l'écriture des dates en timestamps (tableaux de nombres [2023, 10, 25...])
58+
// pour forcer l'utilisation des Strings formatées.
59+
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
60+
objectMapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL); // Skip nulls
61+
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
62+
objectMapper.disable(SerializationFeature.INDENT_OUTPUT); // Compact in prod
63+
64+
// === Deserialization Settings ===
65+
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
66+
objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
67+
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
68+
69+
}
70+
71+
static class CustomOffsetDateTimeDeserializer extends JsonDeserializer<OffsetDateTime> {
72+
73+
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
74+
75+
// figured out that this method is not called during deserialization
76+
@Override
77+
public OffsetDateTime deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
78+
String dateString = p.getText();
79+
try {
80+
return OffsetDateTime.parse(dateString);
81+
} catch (Exception e) {
82+
var localDateTime = LocalDateTime.parse(dateString, FORMATTER);
83+
return localDateTime.atOffset(ZoneOffset.systemDefault().getRules().getOffset(localDateTime));
84+
}
85+
}
86+
87+
}
88+
89+
90+
static class CustomByteDeserializer extends JsonDeserializer<byte[]> {
91+
92+
93+
// figured out that this method is not called during deserialization
94+
public byte[] deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
95+
String text = p.getText();
96+
if (text == null || text.isEmpty()) {
97+
return null;
98+
}
99+
try {
100+
// Utilisation du décodeur standard Java
101+
return Base64.getDecoder().decode(text);
102+
} catch (IllegalArgumentException e) {
103+
// En cas de Base64 invalide
104+
throw new IOException("Impossible de décoder le Base64", e);
105+
}
106+
}
107+
}
108+
109+
static class CustomByteSerializer extends com.fasterxml.jackson.databind.ser.std.StdSerializer<byte[]> {
110+
111+
public CustomByteSerializer(){
112+
super(byte[].class);
113+
}
114+
115+
public void serialize(byte[] value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
116+
if (value == null) {
117+
gen.writeNull();
118+
} else {
119+
// Utilisation de l'encodeur standard Java
120+
String base64String = Base64.getEncoder().encodeToString(value);
121+
gen.writeString(base64String);
122+
}
123+
}
124+
125+
}
126+
127+
}

0 commit comments

Comments
 (0)