This is an automated email from the ASF dual-hosted git repository.

apkhmv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new d8bbcfe99b IGNITE-19107: Remove LATEST semantic from deployment API 
(#1970)
d8bbcfe99b is described below

commit d8bbcfe99b0b6fa197c57cff95184d8323d4b7b7
Author: Mikhail <[email protected]>
AuthorDate: Thu Apr 27 15:22:46 2023 +0300

    IGNITE-19107: Remove LATEST semantic from deployment API (#1970)
---
 .../internal/rest/ItGeneratedRestClientTest.java   |  2 +-
 .../internal/cli/call/unit/UndeployUnitCall.java   |  7 ++--
 .../cli/commands/unit/UnitDeployCommand.java       |  4 ++-
 .../cli/commands/unit/UnitDeployReplCommand.java   |  4 ++-
 .../cli/commands/unit/UnitUndeployCommand.java     |  4 ++-
 .../cli/commands/unit/UnitUndeployReplCommand.java |  4 ++-
 .../cli/commands/UrlOptionsNegativeTest.java       |  4 +--
 .../completer/DynamicCompletionInsiderTest.java    |  1 -
 .../repl/completer/unit/ArgumentParserTest.java    |  1 -
 .../internal/deployunit/IgniteDeployment.java      | 11 ------
 modules/rest-api/openapi/openapi.yaml              | 34 +-----------------
 .../rest/api/deployment/DeploymentCodeApi.java     | 26 +++-----------
 .../DeploymentManagementControllerTest.java        | 41 +++++-----------------
 .../deployment/DeploymentManagementController.java | 19 +++-------
 14 files changed, 35 insertions(+), 127 deletions(-)

diff --git 
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
 
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
index f641c0af03..80cff4aee7 100644
--- 
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
+++ 
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
@@ -417,7 +417,7 @@ public class ItGeneratedRestClientTest {
         assertThat(problem.getDetail(), containsString("Unit test.unit.id with 
version 0.0.0 doesn't exist"));
     }
 
-    private File emptyFile() {
+    private static File emptyFile() {
         try {
             return Files.createTempFile(WORK_DIR, "empty", "file").toFile();
         } catch (IOException e) {
diff --git 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/call/unit/UndeployUnitCall.java
 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/call/unit/UndeployUnitCall.java
index e3b536fa11..bd792c4686 100644
--- 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/call/unit/UndeployUnitCall.java
+++ 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/call/unit/UndeployUnitCall.java
@@ -46,11 +46,8 @@ public class UndeployUnitCall implements 
Call<UndeployUnitCallInput, String> {
     public CallOutput<String> execute(UndeployUnitCallInput input) {
         try {
             DeploymentApi api = new 
DeploymentApi(clientFactory.getClient(input.clusterUrl()));
-            if (input.version() == null || input.version().isEmpty()) {
-                api.undeployLatestUnit(input.id());
-            } else {
-                api.undeployUnit(input.id(), input.version());
-            }
+            api.undeployUnit(input.id(), input.version());
+
             unitsRegistry.refresh();
             return 
DefaultCallOutput.success(MessageUiComponent.from(UiElements.done()).render());
         } catch (ApiException e) {
diff --git 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployCommand.java
 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployCommand.java
index 282be0873a..ef014150a3 100644
--- 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployCommand.java
+++ 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployCommand.java
@@ -53,7 +53,9 @@ public class UnitDeployCommand extends BaseCommand implements 
Callable<Integer>
     private String id;
 
     /** Unit version. */
-    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, description = 
UNIT_VERSION_OPTION_DESC)
+    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT},
+            description = UNIT_VERSION_OPTION_DESC,
+            required = true)
     private String version;
 
     /** Unit path. */
diff --git 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployReplCommand.java
 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployReplCommand.java
index 3dfe89ec5a..3fa3818a5b 100644
--- 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployReplCommand.java
+++ 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployReplCommand.java
@@ -54,7 +54,9 @@ public class UnitDeployReplCommand extends BaseCommand 
implements Runnable {
     private String id;
 
     /** Unit version. */
-    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, description = 
UNIT_VERSION_OPTION_DESC)
+    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT},
+            description = UNIT_VERSION_OPTION_DESC,
+            required = true)
     private String version;
 
     /** Unit path. */
diff --git 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployCommand.java
 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployCommand.java
index 6c47a9fd92..168bb0af9e 100644
--- 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployCommand.java
+++ 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployCommand.java
@@ -47,7 +47,9 @@ public class UnitUndeployCommand extends BaseCommand 
implements Callable<Integer
     private String id;
 
     /** Unit version. */
-    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, description = 
UNIT_VERSION_OPTION_DESC)
+    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT},
+            description = UNIT_VERSION_OPTION_DESC,
+            required = true)
     private String version;
 
     @Inject
diff --git 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployReplCommand.java
 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployReplCommand.java
index 96dd20295d..670fe08ee6 100644
--- 
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployReplCommand.java
+++ 
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitUndeployReplCommand.java
@@ -47,7 +47,9 @@ public class UnitUndeployReplCommand extends BaseCommand 
implements Runnable {
     private String id;
 
     /** Unit version. */
-    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, description = 
UNIT_VERSION_OPTION_DESC)
+    @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT},
+            description = UNIT_VERSION_OPTION_DESC,
+            required = true)
     private String version;
 
     @Inject
diff --git 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java
 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java
index db4d2581e7..f2d4c2476e 100644
--- 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java
+++ 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java
@@ -138,7 +138,7 @@ public class UrlOptionsNegativeTest {
                 arguments(PhysicalTopologyCommand.class, CLUSTER_URL_OPTION, 
List.of()),
                 // TODO https://issues.apache.org/jira/browse/IGNITE-19090
                 // arguments(UnitDeployCommand.class, CLUSTER_URL_OPTION, 
List.of("--path=" + TEMP_FILE_PATH, "id")),
-                arguments(UnitUndeployCommand.class, CLUSTER_URL_OPTION, 
List.of("id")),
+                arguments(UnitUndeployCommand.class, CLUSTER_URL_OPTION, 
List.of("id", "--version=1.0.0")),
                 arguments(UnitStatusCommand.class, CLUSTER_URL_OPTION, 
List.of("id")),
                 arguments(UnitListCommand.class, CLUSTER_URL_OPTION, 
List.of()),
                 arguments(ClusterInitCommand.class, CLUSTER_URL_OPTION, 
List.of("--cluster-name=cluster", "--meta-storage-node=test"))
@@ -163,7 +163,7 @@ public class UrlOptionsNegativeTest {
                 arguments(PhysicalTopologyReplCommand.class, 
CLUSTER_URL_OPTION, List.of()),
                 // TODO https://issues.apache.org/jira/browse/IGNITE-19090
                 // arguments(UnitDeployReplCommand.class, CLUSTER_URL_OPTION, 
List.of("--path=" + TEMP_FILE_PATH, "id")),
-                arguments(UnitUndeployReplCommand.class, CLUSTER_URL_OPTION, 
List.of("id")),
+                arguments(UnitUndeployReplCommand.class, CLUSTER_URL_OPTION, 
List.of("id", "--version=1.0.0")),
                 arguments(UnitStatusReplCommand.class, CLUSTER_URL_OPTION, 
List.of("id")),
                 arguments(UnitListReplCommand.class, CLUSTER_URL_OPTION, 
List.of()),
                 arguments(ClusterInitReplCommand.class, CLUSTER_URL_OPTION, 
List.of("--cluster-name=cluster", "--meta-storage-node=test")),
diff --git 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/DynamicCompletionInsiderTest.java
 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/DynamicCompletionInsiderTest.java
index b71b6888cd..e57e7b388f 100644
--- 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/DynamicCompletionInsiderTest.java
+++ 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/DynamicCompletionInsiderTest.java
@@ -38,7 +38,6 @@ class DynamicCompletionInsiderTest {
                 // here we have completed parameter
                 Arguments.of(new String[]{"connect", "node", ""}, true),
                 Arguments.of(new String[]{"unit", "undeploy"}, false),
-                Arguments.of(new String[]{"unit", "undeploy", "unit.id"}, 
false),
                 Arguments.of(new String[]{"unit", "undeploy", "unit.id", 
"--version"}, true),
                 Arguments.of(new String[]{"unit", "undeploy", "unit.id", 
"--version", "1.0.0"}, true),
                 Arguments.of(new String[]{"node", "config", "show", ""}, 
false),
diff --git 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/unit/ArgumentParserTest.java
 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/unit/ArgumentParserTest.java
index 27cbaa1086..019c457ce6 100644
--- 
a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/unit/ArgumentParserTest.java
+++ 
b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/unit/ArgumentParserTest.java
@@ -27,7 +27,6 @@ import org.junit.jupiter.params.provider.MethodSource;
 class ArgumentParserTest {
     private static Stream<Arguments> wordsSource() {
         return Stream.of(
-                Arguments.of(new String[]{"unit", "undeploy", "unit.id"}, 
"unit.id"),
                 Arguments.of(new String[]{"unit", "undeploy", "unit.id", 
"--version", "1.1.1"}, "unit.id"),
                 // Picocli throws exception here. Probably we will need to use 
another parser.
                 Arguments.of(new String[]{"unit", "undeploy", "unit.id", 
"--version"}, null),
diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
index 48d1d3f14b..7b4571c989 100644
--- 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
@@ -51,17 +51,6 @@ public interface IgniteDeployment extends IgniteComponent {
      */
     CompletableFuture<Boolean> deployAsync(String id, Version version, boolean 
force, DeploymentUnit deploymentUnit);
 
-    /**
-     * Undeploy latest version of unit with corresponding identifier.
-     *
-     * @param id Unit identifier. Not empty and not null.
-     * @return Future completed when unit will be undeployed.
-     *      In case when specified unit not exist future will be failed.
-     */
-    default CompletableFuture<Void> undeployAsync(String id) {
-        return undeployAsync(id, Version.LATEST);
-    }
-
     /**
      * Undeploy unit with corresponding identifier and version.
      * Note that unit files will be deleted asynchronously.
diff --git a/modules/rest-api/openapi/openapi.yaml 
b/modules/rest-api/openapi/openapi.yaml
index f7dd0156c9..521ba29848 100644
--- a/modules/rest-api/openapi/openapi.yaml
+++ b/modules/rest-api/openapi/openapi.yaml
@@ -356,6 +356,7 @@ paths:
               required:
               - unitContent
               - unitId
+              - unitVersion
               type: object
               properties:
                 unitId:
@@ -419,39 +420,6 @@ paths:
             application/problem+json:
               schema:
                 $ref: '#/components/schemas/Problem'
-  /management/v1/deployment/units/{unitId}:
-    delete:
-      tags:
-      - deployment
-      summary: Undeploy latest unit REST method.
-      description: Undeploys the latest unit with the provided unitId.
-      operationId: undeployLatestUnit
-      parameters:
-      - name: unitId
-        in: path
-        required: true
-        schema:
-          type: string
-          description: The ID of the deployment unit.
-      responses:
-        "200":
-          description: Unit undeployed successfully.
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/Void'
-        "404":
-          description: Unit with provided identifier and version does not 
exist.
-          content:
-            application/problem+json:
-              schema:
-                $ref: '#/components/schemas/Problem'
-        "500":
-          description: Internal error.
-          content:
-            application/problem+json:
-              schema:
-                $ref: '#/components/schemas/Problem'
   /management/v1/deployment/units/{unitId}/status:
     get:
       tags:
diff --git 
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
 
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
index 387d139da0..d0cce5424e 100644
--- 
a/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
+++ 
b/modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/deployment/DeploymentCodeApi.java
@@ -68,6 +68,7 @@ public interface DeploymentCodeApi {
                     requiredMode = RequiredMode.REQUIRED,
                     description = "The ID of the deployment unit.") String 
unitId,
             @Schema(name = "unitVersion",
+                    requiredMode = RequiredMode.REQUIRED,
                     description = "The version of the deployment unit.") 
String unitVersion,
             @Schema(name = "unitContent",
                     requiredMode = RequiredMode.REQUIRED,
@@ -90,29 +91,12 @@ public interface DeploymentCodeApi {
     @Consumes(APPLICATION_JSON)
     @Delete("units/{unitId}/{unitVersion}")
     CompletableFuture<Void> undeploy(
-            @PathVariable("unitId") @Schema(name = "unitId", description = 
"The ID of the deployment unit.",
+            @PathVariable("unitId") @Schema(name = "unitId",
+                    description = "The ID of the deployment unit.",
                     requiredMode = RequiredMode.REQUIRED) String unitId,
             @PathVariable("unitVersion") @Schema(name = "unitVersion",
-                    description = "The version of the deployment unit.", 
requiredMode = RequiredMode.REQUIRED) String unitVersion);
-
-    /**
-     * Undeploy latest unit REST method.
-     */
-    @Operation(operationId = "undeployLatestUnit", description = "Undeploys 
the latest unit with the provided unitId.")
-    @ApiResponse(responseCode = "200", description = "Unit undeployed 
successfully.")
-    @ApiResponse(responseCode = "404",
-            description = "Unit with provided identifier and version does not 
exist.",
-            content = @Content(mediaType = PROBLEM_JSON, schema = 
@Schema(implementation = Problem.class))
-    )
-    @ApiResponse(responseCode = "500",
-            description = "Internal error.",
-            content = @Content(mediaType = PROBLEM_JSON, schema = 
@Schema(implementation = Problem.class))
-    )
-    @Consumes(APPLICATION_JSON)
-    @Delete("units/{unitId}")
-    CompletableFuture<Void> undeploy(
-            @PathVariable("unitId") @Schema(name = "unitId", description = 
"The ID of the deployment unit.",
-                    requiredMode = RequiredMode.REQUIRED) String unitId);
+                    description = "The version of the deployment unit.",
+                    requiredMode = RequiredMode.REQUIRED) String unitVersion);
 
     /**
      * All units status REST method.
diff --git 
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
 
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
index dcf1c5974a..eed8bdca6e 100644
--- 
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
+++ 
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementControllerTest.java
@@ -31,6 +31,7 @@ import static org.hamcrest.Matchers.hasItem;
 import static org.hamcrest.Matchers.is;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import io.micronaut.core.type.Argument;
 import io.micronaut.http.HttpRequest;
 import io.micronaut.http.HttpResponse;
 import io.micronaut.http.MediaType;
@@ -50,7 +51,6 @@ import java.nio.file.Path;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import org.apache.ignite.internal.deployunit.version.Version;
 import org.apache.ignite.internal.rest.api.deployment.UnitStatus;
 import org.apache.ignite.internal.testframework.IntegrationTestBase;
 import org.junit.jupiter.api.AfterEach;
@@ -129,19 +129,16 @@ public class DeploymentManagementControllerTest extends 
IntegrationTestBase {
     }
 
     @Test
-    public void testDeploySuccessfulWithoutVersion() {
+    public void testDeployFailedWithoutVersion() {
         String id = "testId";
-        HttpResponse<Object> response = deploy(id);
 
-        assertThat(response.code(), is(OK.code()));
+        HttpClientResponseException e = 
assertThrows(HttpClientResponseException.class, () -> deploy(id));
+        assertThat(e.getResponse().code(), is(BAD_REQUEST.code()));
 
         MutableHttpRequest<Object> get = HttpRequest.GET("units");
-        UnitStatus status = client.toBlocking().retrieve(get, 
UnitStatus.class);
+        List<UnitStatus> status = client.toBlocking().retrieve(get, 
Argument.listOf(UnitStatus.class));
 
-        String version = Version.LATEST.render();
-        assertThat(status.id(), is(id));
-        assertThat(status.versionToDeploymentInfo().keySet(), 
equalTo(Set.of(version)));
-        
assertThat(status.versionToDeploymentInfo().get(version).consistentIds(), 
hasItem(CLUSTER_NODE_NAMES.get(0)));
+        assertThat(status.size(), is(0));
     }
 
     @Test
@@ -185,23 +182,9 @@ public class DeploymentManagementControllerTest extends 
IntegrationTestBase {
         assertThat(versions(id), equalTo(Collections.emptyList()));
     }
 
-    @Test
-    public void testDeployUndeployLatest() {
-        String id = "testId";
-        HttpResponse<Object> response = deploy(id);
-
-        assertThat(response.code(), is(OK.code()));
-        MutableHttpRequest<Object> delete = HttpRequest
-                .DELETE("units/" + id)
-                .contentType(MediaType.APPLICATION_JSON);
-        response = client.toBlocking().exchange(delete);
-        assertThat(response.code(), is(OK.code()));
-    }
-
     @Test
     public void testVersionOrder() {
         String id = "unitId";
-        deploy(id);
         deploy(id, "1.1.1");
         deploy(id, "1.1.2");
         deploy(id, "1.2.1");
@@ -211,7 +194,7 @@ public class DeploymentManagementControllerTest extends 
IntegrationTestBase {
 
         List<String> versions = versions(id);
 
-        assertThat(versions, contains("1.0.0", "1.0.1", "1.1.1", "1.1.2", 
"1.2.1", "2.0.0", "latest"));
+        assertThat(versions, contains("1.0.0", "1.0.1", "1.1.1", "1.1.2", 
"1.2.1", "2.0.0"));
     }
 
     private HttpResponse<Object> deploy(String id) {
@@ -238,14 +221,6 @@ public class DeploymentManagementControllerTest extends 
IntegrationTestBase {
         return client.toBlocking().exchange(post);
     }
 
-    private HttpResponse<Object> undeploy(String id) {
-        MutableHttpRequest<Object> delete = HttpRequest
-                .DELETE("units/" + id)
-                .contentType(MediaType.APPLICATION_JSON);
-
-        return client.toBlocking().exchange(delete);
-    }
-
     private HttpResponse<Object> undeploy(String id, String version) {
         MutableHttpRequest<Object> delete = HttpRequest
                 .DELETE("units/" + id + "/" + version)
@@ -259,7 +234,7 @@ public class DeploymentManagementControllerTest extends 
IntegrationTestBase {
                 .GET("units/" + id + "/versions")
                 .contentType(MediaType.APPLICATION_JSON);
 
-        return client.toBlocking().retrieve(versions, List.class);
+        return client.toBlocking().retrieve(versions, 
Argument.listOf(String.class));
 
     }
 
diff --git 
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
 
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
index 7ebe26611d..9edb144800 100644
--- 
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
+++ 
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
@@ -27,6 +27,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 import org.apache.ignite.internal.deployunit.DeploymentUnit;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
+import org.apache.ignite.internal.deployunit.version.UnitVersion;
 import org.apache.ignite.internal.deployunit.version.Version;
 import org.apache.ignite.internal.rest.api.deployment.DeploymentCodeApi;
 import org.apache.ignite.internal.rest.api.deployment.DeploymentInfo;
@@ -48,17 +49,12 @@ public class DeploymentManagementController implements 
DeploymentCodeApi {
     public CompletableFuture<Boolean> deploy(String unitId, String 
unitVersion, Publisher<CompletedFileUpload> unitContent) {
         CompletableFuture<DeploymentUnit> result = new CompletableFuture<>();
         unitContent.subscribe(new CompletedFileUploadSubscriber(result));
-        return result.thenCompose(deploymentUnit -> 
deployment.deployAsync(unitId, parseVersion(unitVersion), deploymentUnit));
+        return result.thenCompose(deploymentUnit -> 
deployment.deployAsync(unitId, UnitVersion.parse(unitVersion), deploymentUnit));
     }
 
     @Override
     public CompletableFuture<Void> undeploy(String unitId, String unitVersion) 
{
-        return deployment.undeployAsync(unitId, 
Version.parseVersion(unitVersion));
-    }
-
-    @Override
-    public CompletableFuture<Void> undeploy(String unitId) {
-        return deployment.undeployAsync(unitId);
+        return deployment.undeployAsync(unitId, 
UnitVersion.parse(unitVersion));
     }
 
     @Override
@@ -91,7 +87,7 @@ public class DeploymentManagementController implements 
DeploymentCodeApi {
      * @param status Unit status.
      * @return Unit status DTO.
      */
-    public static UnitStatus 
fromUnitStatus(org.apache.ignite.internal.deployunit.UnitStatus status) {
+    private static UnitStatus 
fromUnitStatus(org.apache.ignite.internal.deployunit.UnitStatus status) {
         Map<String, DeploymentInfo> versionToDeploymentStatus = new 
HashMap<>();
         Set<Version> versions = status.versions();
         for (Version version : versions) {
@@ -100,11 +96,4 @@ public class DeploymentManagementController implements 
DeploymentCodeApi {
         }
         return new UnitStatus(status.id(), versionToDeploymentStatus);
     }
-
-    private static Version parseVersion(String unitVersion) {
-        if (unitVersion == null || unitVersion.isBlank()) {
-            return Version.LATEST;
-        }
-        return Version.parseVersion(unitVersion);
-    }
 }

Reply via email to