|
1 | 1 | /* |
2 | | - * Copyright 2023-2024 IEXEC BLOCKCHAIN TECH |
| 2 | + * Copyright 2023-2025 IEXEC BLOCKCHAIN TECH |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -28,48 +28,33 @@ class PublicConfigurationTests { |
28 | 28 |
|
29 | 29 | @Test |
30 | 30 | void shouldSerializeAndDeserialize() throws JsonProcessingException { |
31 | | - PublicConfiguration config = PublicConfiguration.builder().build(); |
32 | | - String jsonString = mapper.writeValueAsString(config); |
| 31 | + final PublicConfiguration config = PublicConfiguration.builder().build(); |
| 32 | + final String jsonString = mapper.writeValueAsString(config); |
33 | 33 | assertThat(jsonString).isEqualTo("{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
34 | | - "\"blockchainAdapterUrl\":null,\"configServerUrl\":null,\"resultRepositoryURL\":null," + |
| 34 | + "\"configServerUrl\":null,\"resultRepositoryURL\":null," + |
35 | 35 | "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"); |
36 | | - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
| 36 | + final PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
37 | 37 | assertThat(parsedConfig).isEqualTo(config); |
38 | 38 | } |
39 | 39 |
|
40 | 40 | @Test |
41 | | - void shouldDeserializeWhenBlockchainAdapterUrlIsPresentButConfigServerUrlNot() throws JsonProcessingException { |
42 | | - |
43 | | - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
44 | | - "\"blockchainAdapterUrl\":\"http://localhost:8080\",\"resultRepositoryURL\":null," + |
45 | | - "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; |
46 | | - |
47 | | - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
48 | | - assertThat(parsedConfig.getBlockchainAdapterUrl()).isEqualTo("http://localhost:8080"); |
49 | | - assertThat(parsedConfig.getConfigServerUrl()).isNull(); |
50 | | - } |
51 | | - |
52 | | - @Test |
53 | | - void shouldDeserializeWhenConfigServerUrlIsPresentButBlockchainAdapterUrlNot() throws JsonProcessingException { |
54 | | - |
55 | | - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
56 | | - "\"configServerUrl\":\"http://localhost:8080\",\"resultRepositoryURL\":null," + |
| 41 | + void shouldDeserializeWhenConfigServerUrlIsMissing() throws JsonProcessingException { |
| 42 | + final PublicConfiguration config = PublicConfiguration.builder().build(); |
| 43 | + final String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
| 44 | + "\"resultRepositoryURL\":null," + |
57 | 45 | "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; |
58 | | - |
59 | | - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
60 | | - assertThat(parsedConfig.getConfigServerUrl()).isEqualTo("http://localhost:8080"); |
61 | | - assertThat(parsedConfig.getBlockchainAdapterUrl()).isNull(); |
| 46 | + final PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
| 47 | + assertThat(parsedConfig).isEqualTo(config); |
62 | 48 | } |
63 | 49 |
|
64 | 50 | @Test |
65 | | - void shouldDeserializeWhenConfigServerUrlAndBlockchainAdapterUrlArePresent() throws JsonProcessingException { |
66 | | - |
67 | | - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
68 | | - "\"configServerUrl\":\"http://localhost:8080\",\"blockchainAdapterUrl\":\"http://localhost:8082\",\"resultRepositoryURL\":null," + |
| 51 | + void shouldDeserializeWhenConfigServerUrlIsPresent() throws JsonProcessingException { |
| 52 | + final PublicConfiguration config = PublicConfiguration.builder() |
| 53 | + .configServerUrl("http://localhost:8888").build(); |
| 54 | + final String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + |
| 55 | + "\"configServerUrl\":\"http://localhost:8888\",\"resultRepositoryURL\":null," + |
69 | 56 | "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; |
70 | | - |
71 | | - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
72 | | - assertThat(parsedConfig.getConfigServerUrl()).isEqualTo("http://localhost:8080"); |
73 | | - assertThat(parsedConfig.getBlockchainAdapterUrl()).isEqualTo("http://localhost:8082"); |
| 57 | + final PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); |
| 58 | + assertThat(parsedConfig).isEqualTo(config); |
74 | 59 | } |
75 | 60 | } |
0 commit comments