Skip to content

Commit 161ec15

Browse files
committed
EIS-5488: Upgrading Spring boot version to 3.5.4
1 parent faab9ef commit 161ec15

31 files changed

Lines changed: 122 additions & 72 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id "org.owasp.dependencycheck" version "9.0.9"
44
}
55

6-
ext.projectVersion = '3.1.3-SNAPSHOT'
6+
ext.projectVersion = '3.2.0-SNAPSHOT'
77
ext.isReleaseVersion = !ext.projectVersion.endsWith('SNAPSHOT')
88

99
ext.mavenRepoUrl = project.properties['mavenRepoUrl'] ?: 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'

symphony-bdk-bom/build.gradle

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repositories {
1616

1717
dependencies {
1818
// import Spring Boot's BOM
19-
api platform('org.springframework.boot:spring-boot-dependencies:3.3.12')
19+
api platform('org.springframework.boot:spring-boot-dependencies:3.5.4')
2020
// import Jackson's BOM
2121
api platform('com.fasterxml.jackson:jackson-bom:2.18.2')
2222
// import Jersey's BOM
@@ -70,13 +70,14 @@ dependencies {
7070
api 'com.github.jknack:handlebars:4.3.1'
7171
api 'org.reflections:reflections:0.10.2'
7272

73-
api 'org.junit.jupiter:junit-jupiter:5.10.1'
74-
api 'org.junit.jupiter:junit-jupiter-api:5.10.1'
75-
api 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
73+
api "org.junit.jupiter:junit-jupiter:5.10.1"
74+
api "org.junit.jupiter:junit-jupiter-api:5.10.1"
75+
api "org.junit.jupiter:junit-jupiter-engine:5.10.1"
76+
api "org.junit.platform:junit-platform-launcher:1.10.1"
7677
api 'com.tngtech.archunit:archunit-junit5:1.2.1'
7778
api 'org.mock-server:mockserver-netty:5.15.0'
78-
api 'org.mockito:mockito-core:5.8.0'
79-
api 'org.mockito:mockito-junit-jupiter:5.8.0'
79+
api "org.mockito:mockito-core:5.11.0"
80+
api "org.mockito:mockito-junit-jupiter:5.11.0"
8081
api 'org.assertj:assertj-core:3.24.2'
8182

8283
api 'jakarta.ws.rs:jakarta.ws.rs-api:3.1.0'

symphony-bdk-config/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ dependencies {
2424
testImplementation 'org.junit.jupiter:junit-jupiter'
2525
testImplementation 'ch.qos.logback:logback-classic'
2626
testImplementation 'org.assertj:assertj-core'
27+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2728
}

symphony-bdk-config/src/main/java/com/symphony/bdk/core/config/BdkConfigParser.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ public JsonNode parse(InputStream inputStream) throws BdkConfigException {
4646
}
4747

4848
public JsonNode parseJsonNode(InputStream inputStream) throws BdkConfigException {
49-
String content = new BufferedReader(
50-
new InputStreamReader(inputStream, StandardCharsets.UTF_8))
51-
.lines()
52-
.collect(Collectors.joining("\n"));
49+
String content = "";
50+
try (
51+
InputStreamReader isr = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
52+
BufferedReader reader = new BufferedReader(isr)) {
53+
content = reader.lines().collect(Collectors.joining("\n"));
54+
} catch (IOException e) {
55+
log.error("Error: {}", e.getMessage());
56+
}
5357
try {
5458
return JSON_MAPPER.readTree(content);
5559
} catch (IOException e) {
56-
log.debug("Config file is not in JSON format, checking for YAML format.");
60+
log.error("Error: {}", e.getMessage());
5761
}
5862

5963
try {

symphony-bdk-config/src/test/java/com/symphony/bdk/core/config/BdkConfigLoaderTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.junit.jupiter.api.io.TempDir;
1717

1818
import java.io.FileOutputStream;
19+
import java.io.OutputStream;
1920
import java.io.IOException;
2021
import java.io.InputStream;
2122
import java.nio.file.Files;
@@ -178,8 +179,12 @@ void testLoadConfigFromSymphonyDirectory() throws Exception {
178179
final String tmpConfigFileName = UUID.randomUUID().toString() + "-config.yaml";
179180
final Path tmpConfigPath = Paths.get(System.getProperty("user.home"), ".symphony", tmpConfigFileName);
180181
FileUtils.forceMkdirParent(tmpConfigPath.toFile());
181-
final InputStream configInputStream = this.getClass().getResourceAsStream("/config/config.yaml");
182-
IOUtils.copy(configInputStream, new FileOutputStream(tmpConfigPath.toFile()));
182+
try (
183+
InputStream configInputStream = this.getClass().getResourceAsStream("/config/config.yaml");
184+
OutputStream out = new FileOutputStream(tmpConfigPath.toFile())
185+
) {
186+
IOUtils.copy(configInputStream, out);
187+
}
183188

184189
final BdkConfig config = BdkConfigLoader.loadFromSymphonyDir(tmpConfigFileName);
185190
assertThat(config).isNotNull();

symphony-bdk-core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ dependencies {
7272
testImplementation 'org.mockito:mockito-core'
7373
testImplementation 'org.mockito:mockito-junit-jupiter'
7474
testImplementation 'org.assertj:assertj-core'
75+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
7576
}
7677

7778
// OpenAPI code generation

symphony-bdk-core/src/main/java/com/symphony/bdk/core/auth/AuthenticatorFactory.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,13 @@ private static String loadPrivateKey(String privateKeyPath) throws IOException,
225225
throw new AuthInitializationException(
226226
"Unable to find RSA private key as classpath resource from: " + privateKeyPath);
227227
}
228+
try (InputStream resourceStream = is) {
229+
return IOUtils.toString(resourceStream, StandardCharsets.UTF_8);
230+
}
228231
} else {
229-
is = new FileInputStream(privateKeyPath);
232+
try (InputStream fileStream = new FileInputStream(privateKeyPath)) {
233+
return IOUtils.toString(fileStream, StandardCharsets.UTF_8);
234+
}
230235
}
231-
232-
return IOUtils.toString(is, StandardCharsets.UTF_8);
233236
}
234237
}

symphony-bdk-core/src/test/java/com/symphony/bdk/core/auth/AuthenticatorFactoryTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.junit.jupiter.api.io.TempDir;
2929

3030
import java.io.FileOutputStream;
31+
import java.io.OutputStream;
32+
import java.nio.charset.StandardCharsets;
3133
import java.nio.file.Path;
3234
import java.util.UUID;
3335
import java.util.function.Supplier;
@@ -387,6 +389,8 @@ private BdkConfig createRsaConfigDeprecatedPath(Supplier<String> privateKeyPathS
387389

388390
@SneakyThrows
389391
private static void writeContentToPath(String content, Path path) {
390-
IOUtils.write(content, new FileOutputStream(path.toFile()), "utf-8");
392+
try (OutputStream out = new FileOutputStream(path.toFile())) {
393+
IOUtils.write(content, out, StandardCharsets.UTF_8);
394+
}
391395
}
392396
}

symphony-bdk-core/src/test/java/com/symphony/bdk/core/service/message/MessageServiceTest.java

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import java.io.FileOutputStream;
6161
import java.io.IOException;
6262
import java.io.InputStream;
63+
import java.io.OutputStream;
6364
import java.nio.charset.StandardCharsets;
6465
import java.nio.file.Path;
6566
import java.time.Instant;
@@ -183,7 +184,6 @@ void testGetMessages() throws IOException {
183184
messages.stream().map(V4Message::getMessageId).collect(Collectors.toList()));
184185
}
185186

186-
187187
@Test
188188
void testSearchMessages() throws IOException {
189189
mockApiClient.onPost(V4_SEARCH_MESSAGES,
@@ -238,71 +238,83 @@ void testSendWithStreamObjectCallsSendWithStreamId() {
238238
@Test
239239
void testSendPassingMessageInstanceToStreamId(@TempDir Path tmpDir) throws IOException {
240240
Path tempFilePath = tmpDir.resolve("tempFile");
241-
IOUtils.write("test", new FileOutputStream(tempFilePath.toFile()), StandardCharsets.UTF_8);
241+
try (OutputStream out = new FileOutputStream(tempFilePath.toFile())) {
242+
IOUtils.write("test", out, StandardCharsets.UTF_8);
243+
}
244+
242245
mockApiClient.onPost(V4_STREAM_MESSAGE_CREATE.replace("{sid}", STREAM_ID),
243246
JsonHelper.readFromClasspath("/message/send_message.json"));
244247

245-
InputStream inputStream = new FileInputStream(tempFilePath.toString());
246-
Message message = Message.builder()
247-
.content(MESSAGE)
248-
.addAttachment(inputStream, "test.png")
249-
.build();
248+
try (InputStream inputStream = new FileInputStream(tempFilePath.toString())) {
249+
Message message = Message.builder()
250+
.content(MESSAGE)
251+
.addAttachment(inputStream, "test.png")
252+
.build();
250253

251-
final V4Message sentMessage = messageService.send(STREAM_ID, message);
254+
final V4Message sentMessage = messageService.send(STREAM_ID, message);
252255

253-
assertEquals(MESSAGE_ID, sentMessage.getMessageId());
254-
assertEquals("gXFV8vN37dNqjojYS_y2wX___o2KxfmUdA", sentMessage.getStream().getStreamId());
256+
assertEquals(MESSAGE_ID, sentMessage.getMessageId());
257+
assertEquals("gXFV8vN37dNqjojYS_y2wX___o2KxfmUdA", sentMessage.getStream().getStreamId());
258+
}
255259
}
256260

257261
@Test
258262
void testSendPassingMessageInstanceToStream(@TempDir Path tmpDir) throws IOException {
259263
Path tempFilePath = tmpDir.resolve("tempFile");
260-
IOUtils.write("test", new FileOutputStream(tempFilePath.toFile()), StandardCharsets.UTF_8);
264+
try (OutputStream out = new FileOutputStream(tempFilePath.toFile())) {
265+
IOUtils.write("test", out, StandardCharsets.UTF_8);
266+
}
261267
mockApiClient.onPost(V4_STREAM_MESSAGE_CREATE.replace("{sid}", STREAM_ID),
262268
JsonHelper.readFromClasspath("/message/send_message.json"));
263269

264-
InputStream inputStream = new FileInputStream(tempFilePath.toString());
265-
Message message = Message.builder()
266-
.content(MESSAGE)
267-
.addAttachment(inputStream, "test.png")
268-
.build();
270+
try (InputStream inputStream = new FileInputStream(tempFilePath.toString())) {
271+
Message message = Message.builder()
272+
.content(MESSAGE)
273+
.addAttachment(inputStream, "test.png")
274+
.build();
269275

270-
final V4Message sentMessage = messageService.send(new V4Stream().streamId(STREAM_ID), message);
276+
final V4Message sentMessage = messageService.send(new V4Stream().streamId(STREAM_ID), message);
271277

272-
assertEquals(MESSAGE_ID, sentMessage.getMessageId());
273-
assertEquals("gXFV8vN37dNqjojYS_y2wX___o2KxfmUdA", sentMessage.getStream().getStreamId());
278+
assertEquals(MESSAGE_ID, sentMessage.getMessageId());
279+
assertEquals("gXFV8vN37dNqjojYS_y2wX___o2KxfmUdA", sentMessage.getStream().getStreamId());
280+
}
274281
}
275282

276283
@Test
277284
void testSendPassingMessageInstanceToStreamWrongAttachmentName(@TempDir Path tmpDir) throws IOException {
278285
Path tempFilePath = tmpDir.resolve("tempFile");
279-
IOUtils.write("test", new FileOutputStream(tempFilePath.toFile()), StandardCharsets.UTF_8);
286+
try (OutputStream out = new FileOutputStream(tempFilePath.toFile())) {
287+
IOUtils.write("test", out, StandardCharsets.UTF_8);
288+
}
280289
mockApiClient.onPost(V4_STREAM_MESSAGE_CREATE.replace("{sid}", STREAM_ID),
281290
JsonHelper.readFromClasspath("/message/send_message.json"));
282291

283-
InputStream inputStream = new FileInputStream(tempFilePath.toString());
284-
285-
assertThrows(MessageCreationException.class,
286-
() -> {
287-
final Message message = Message.builder()
288-
.content(MESSAGE)
289-
.addAttachment(inputStream, "wrong-name")
290-
.build();
291-
messageService.send(new V4Stream().streamId(STREAM_ID), message);
292-
});
292+
try (InputStream inputStream = new FileInputStream(tempFilePath.toString())) {
293+
assertThrows(MessageCreationException.class,
294+
() -> {
295+
final Message message = Message.builder()
296+
.content(MESSAGE)
297+
.addAttachment(inputStream, "wrong-name")
298+
.build();
299+
messageService.send(new V4Stream().streamId(STREAM_ID), message);
300+
});
301+
}
293302
}
294303

295304
@Test
296305
void testMessageCreationFailed(@TempDir Path tmpDir) throws IOException {
297306
Path tempFilePath = tmpDir.resolve("tempFile");
298-
IOUtils.write("test", new FileOutputStream(tempFilePath.toFile()), StandardCharsets.UTF_8);
307+
try (OutputStream out = new FileOutputStream(tempFilePath.toFile())) {
308+
IOUtils.write("test", out, StandardCharsets.UTF_8);
309+
}
299310

300-
InputStream inputStream = new FileInputStream(tempFilePath.toString());
301-
assertThrows(MessageCreationException.class,
302-
() -> Message.builder()
303-
.content(MESSAGE)
304-
.addAttachment(inputStream, "test.png")
305-
.data(new MockObject("wrong object")).build());
311+
try (InputStream inputStream = new FileInputStream(tempFilePath.toString())) {
312+
assertThrows(MessageCreationException.class,
313+
() -> Message.builder()
314+
.content(MESSAGE)
315+
.addAttachment(inputStream, "test.png")
316+
.data(new MockObject("wrong object")).build());
317+
}
306318
}
307319

308320
@Test

symphony-bdk-examples/bdk-core-examples/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ dependencies {
2626

2727
compileOnly 'org.projectlombok:lombok'
2828
annotationProcessor 'org.projectlombok:lombok'
29+
testImplementation 'org.junit.jupiter:junit-jupiter'
30+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2931
}

0 commit comments

Comments
 (0)