diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9809a3..f6814752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. - Upgrade source and target compatibility to Java 17. (#467) +### Breaking API changes + +- Remove PublicConfiguration class moved to iexec-core-library. (#468) + ### Dependency Upgrades - Upgrade to Spring Boot 3.0.13. (#467) diff --git a/src/main/java/com/iexec/common/config/PublicConfiguration.java b/src/main/java/com/iexec/common/config/PublicConfiguration.java deleted file mode 100644 index 6b04134c..00000000 --- a/src/main/java/com/iexec/common/config/PublicConfiguration.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2020-2024 IEXEC BLOCKCHAIN TECH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.iexec.common.config; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; -import lombok.Builder; -import lombok.Value; - -/** - * The {@link #blockchainAdapterUrl} and {@link #configServerUrl} fields are repetitive, - * so if both are populated, they must contain the same value. - * Duplicating these fields ensures worker/scheduler compatibility on different v8 versions. - * In v9, the {@link #blockchainAdapterUrl} field will be removed. - */ -@Value -@Builder -@JsonDeserialize(builder = PublicConfiguration.PublicConfigurationBuilder.class) -public class PublicConfiguration { - String workerPoolAddress; - String schedulerPublicAddress; - /** - * @deprecated Use {@link PublicConfiguration#configServerUrl} instead. - */ - @Deprecated(forRemoval = true) - String blockchainAdapterUrl; - String configServerUrl; - String resultRepositoryURL; - long askForReplicatePeriod; - String requiredWorkerVersion; - - @JsonPOJOBuilder(withPrefix = "") - public static class PublicConfigurationBuilder { - } -} - diff --git a/src/test/java/com/iexec/common/config/PublicConfigurationTests.java b/src/test/java/com/iexec/common/config/PublicConfigurationTests.java deleted file mode 100644 index 09042b61..00000000 --- a/src/test/java/com/iexec/common/config/PublicConfigurationTests.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2023-2024 IEXEC BLOCKCHAIN TECH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.iexec.common.config; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -class PublicConfigurationTests { - - private static final ObjectMapper mapper = new ObjectMapper(); - - @Test - void shouldSerializeAndDeserialize() throws JsonProcessingException { - PublicConfiguration config = PublicConfiguration.builder().build(); - String jsonString = mapper.writeValueAsString(config); - assertThat(jsonString).isEqualTo("{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + - "\"blockchainAdapterUrl\":null,\"configServerUrl\":null,\"resultRepositoryURL\":null," + - "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"); - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); - assertThat(parsedConfig).isEqualTo(config); - } - - @Test - void shouldDeserializeWhenBlockchainAdapterUrlIsPresentButConfigServerUrlNot() throws JsonProcessingException { - - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + - "\"blockchainAdapterUrl\":\"http://localhost:8080\",\"resultRepositoryURL\":null," + - "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; - - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); - assertThat(parsedConfig.getBlockchainAdapterUrl()).isEqualTo("http://localhost:8080"); - assertThat(parsedConfig.getConfigServerUrl()).isNull(); - } - - @Test - void shouldDeserializeWhenConfigServerUrlIsPresentButBlockchainAdapterUrlNot() throws JsonProcessingException { - - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + - "\"configServerUrl\":\"http://localhost:8080\",\"resultRepositoryURL\":null," + - "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; - - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); - assertThat(parsedConfig.getConfigServerUrl()).isEqualTo("http://localhost:8080"); - assertThat(parsedConfig.getBlockchainAdapterUrl()).isNull(); - } - - @Test - void shouldDeserializeWhenConfigServerUrlAndBlockchainAdapterUrlArePresent() throws JsonProcessingException { - - String jsonString = "{\"workerPoolAddress\":null,\"schedulerPublicAddress\":null," + - "\"configServerUrl\":\"http://localhost:8080\",\"blockchainAdapterUrl\":\"http://localhost:8082\",\"resultRepositoryURL\":null," + - "\"askForReplicatePeriod\":0,\"requiredWorkerVersion\":null}"; - - PublicConfiguration parsedConfig = mapper.readValue(jsonString, PublicConfiguration.class); - assertThat(parsedConfig.getConfigServerUrl()).isEqualTo("http://localhost:8080"); - assertThat(parsedConfig.getBlockchainAdapterUrl()).isEqualTo("http://localhost:8082"); - } -}