diff --git a/CHANGELOG.md b/CHANGELOG.md index fb993deb..2f70ccdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. - Configure Gradle JVM Test Suite Plugin. (#691) - Rename `IexecTaskApiClient` to `TaskApiClient`. (#696) +- Move `ReplicateTaskSummary` from `iexec-common` to `iexec-core`. (#704) ### Dependency Upgrades diff --git a/iexec-core-library/src/main/java/com/iexec/core/replicate/ReplicateTaskSummary.java b/iexec-core-library/src/main/java/com/iexec/core/replicate/ReplicateTaskSummary.java new file mode 100644 index 00000000..6f83f09e --- /dev/null +++ b/iexec-core-library/src/main/java/com/iexec/core/replicate/ReplicateTaskSummary.java @@ -0,0 +1,34 @@ +/* + * Copyright 2022-2023 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.core.replicate; + +import com.iexec.commons.poco.chain.WorkerpoolAuthorization; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class ReplicateTaskSummary { + + private WorkerpoolAuthorization workerpoolAuthorization; + private String smsUrl; + +} diff --git a/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java b/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java index 7e4099d1..1ab27094 100644 --- a/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java +++ b/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java @@ -21,8 +21,6 @@ import com.iexec.common.replicate.ReplicateStatus; import com.iexec.common.replicate.ReplicateStatusDetails; import com.iexec.common.replicate.ReplicateStatusUpdate; -import com.iexec.common.replicate.ReplicateTaskSummary; -import com.iexec.common.replicate.ReplicateTaskSummary.ReplicateTaskSummaryBuilder; import com.iexec.commons.poco.chain.WorkerpoolAuthorization; import com.iexec.commons.poco.task.TaskAbortCause; import com.iexec.core.chain.SignatureService; @@ -31,6 +29,7 @@ import com.iexec.core.notification.TaskNotification; import com.iexec.core.notification.TaskNotificationExtra; import com.iexec.core.notification.TaskNotificationType; +import com.iexec.core.replicate.ReplicateTaskSummary.ReplicateTaskSummaryBuilder; import com.iexec.core.task.Task; import com.iexec.core.task.TaskService; import com.iexec.core.task.TaskStatus; diff --git a/src/main/java/com/iexec/core/replicate/ReplicatesController.java b/src/main/java/com/iexec/core/replicate/ReplicatesController.java index 256bf2aa..e4363813 100644 --- a/src/main/java/com/iexec/core/replicate/ReplicatesController.java +++ b/src/main/java/com/iexec/core/replicate/ReplicatesController.java @@ -16,7 +16,9 @@ package com.iexec.core.replicate; -import com.iexec.common.replicate.*; +import com.iexec.common.replicate.ReplicateStatusDetails; +import com.iexec.common.replicate.ReplicateStatusModifier; +import com.iexec.common.replicate.ReplicateStatusUpdate; import com.iexec.core.chain.BlockchainConnectionHealthIndicator; import com.iexec.core.notification.TaskNotification; import com.iexec.core.notification.TaskNotificationType; @@ -139,14 +141,10 @@ public ResponseEntity updateReplicateStatus( statusUpdate.setModifier(ReplicateStatusModifier.WORKER); statusUpdate.setDate(new Date()); - // Assuming wallet address sent by the worker is correct - // would be a security issue. Let's replace it. + // Assuming wallet address sent by the worker is correct would be a security issue. Let's replace it. final ReplicateStatusDetails details = statusUpdate.getDetails(); - if (details != null) { - final ComputeLogs computeLogs = details.getComputeLogs(); - if (computeLogs != null) { - computeLogs.setWalletAddress(walletAddress); - } + if (details != null && details.getComputeLogs() != null) { + details.getComputeLogs().setWalletAddress(walletAddress); } log.debug("Worker request to update a replicate status [workerAddress:{}, chainTaskId:{}, statusUpdate:{}]", walletAddress, chainTaskId, statusUpdate); diff --git a/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java b/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java index 17c3e0ce..bc8889eb 100644 --- a/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java +++ b/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java @@ -19,7 +19,6 @@ import com.iexec.common.replicate.ReplicateStatus; import com.iexec.common.replicate.ReplicateStatusModifier; import com.iexec.common.replicate.ReplicateStatusUpdate; -import com.iexec.common.replicate.ReplicateTaskSummary; import com.iexec.commons.poco.chain.WorkerpoolAuthorization; import com.iexec.commons.poco.task.TaskAbortCause; import com.iexec.commons.poco.tee.TeeUtils;