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

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


The following commit(s) were added to refs/heads/IGNITE-25508 by this push:
     new 74bf0f77fc4 Fix checkstyle
74bf0f77fc4 is described below

commit 74bf0f77fc4fe05e3371d6fd711e29661d09cdd9
Author: Pochatkin Mikhail <[email protected]>
AuthorDate: Fri Sep 5 16:18:14 2025 +0300

    Fix checkstyle
---
 .../deployment/ItStaticDeploymentTest.java         | 23 +++++++++++----
 .../deployunit/StaticDeploymentUnitObserver.java   | 34 ++++++++++++++++------
 .../metastore/DeploymentUnitStoreImpl.java         |  1 -
 .../StaticDeploymentUnitObserverTest.java          |  3 ++
 .../deployunit/StubDeploymentUnitStore.java        |  6 ++--
 5 files changed, 48 insertions(+), 19 deletions(-)

diff --git 
a/modules/code-deployment/src/integrationTest/java/org/apache/ignite/internal/deployment/ItStaticDeploymentTest.java
 
b/modules/code-deployment/src/integrationTest/java/org/apache/ignite/internal/deployment/ItStaticDeploymentTest.java
index f79a2bbdb4f..359c308ef9e 100644
--- 
a/modules/code-deployment/src/integrationTest/java/org/apache/ignite/internal/deployment/ItStaticDeploymentTest.java
+++ 
b/modules/code-deployment/src/integrationTest/java/org/apache/ignite/internal/deployment/ItStaticDeploymentTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.ignite.internal.deployment;
 
 import static org.apache.ignite.deployment.version.Version.parseVersion;
@@ -5,18 +22,12 @@ import static 
org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 import java.io.IOException;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.concurrent.CompletableFuture;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.deployment.version.Version;
-import org.apache.ignite.internal.Cluster;
 import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
-import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
 import org.apache.ignite.internal.deployunit.DeploymentStatus;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
 import 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher;
-import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserver.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserver.java
index a12efeb62d4..9ff076f4e74 100644
--- 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserver.java
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserver.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.deployunit;
 
-import static java.util.UUID.randomUUID;
-import static java.util.stream.Collectors.toMap;
 import static org.apache.ignite.deployment.version.Version.parseVersion;
 import static org.apache.ignite.internal.deployunit.DeploymentStatus.DEPLOYED;
 import static org.apache.ignite.internal.util.CompletableFutures.allOf;
@@ -34,15 +32,25 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 import org.apache.ignite.deployment.version.Version;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitReadException;
 import org.apache.ignite.internal.deployunit.metastore.DeploymentUnitStore;
 import org.apache.ignite.internal.deployunit.metastore.status.UnitNodeStatus;
 import org.apache.ignite.internal.logger.IgniteLogger;
 import org.apache.ignite.internal.logger.Loggers;
 
+/**
+ * Observes a predefined directory with statically provisioned deployment 
units and
+ * registers their presence in the deployment store.
+ *
+ * <p>The observer scans the {@code deploymentUnitsRoot} directory, expecting 
the following structure:
+ * {@code <unitId>/<version>/}
+ * For every discovered {@code unitId}-{@code version} pair that is not yet 
registered for this node,
+ * the observer creates (or reuses) a cluster status and then creates the node 
status marked as
+ * {@link DeploymentStatus#DEPLOYED}.
+ */
 public class StaticDeploymentUnitObserver {
     private static final IgniteLogger LOG = 
Loggers.forClass(StaticDeploymentUnitObserver.class);
 
@@ -52,6 +60,9 @@ public class StaticDeploymentUnitObserver {
 
     private final Path deploymentUnitsRoot;
 
+    /**
+     * Constructor.
+     */
     public StaticDeploymentUnitObserver(
             DeploymentUnitStore deploymentUnitStore,
             String nodeName,
@@ -62,11 +73,15 @@ public class StaticDeploymentUnitObserver {
         this.deploymentUnitsRoot = deploymentUnitsRoot;
     }
 
+    /**
+     * Scans the filesystem for statically deployed units and registers their 
cluster and node statuses
+     * if they are not yet present in the store.
+     *
+     * <p>Already registered unit versions for this node are skipped. New ones 
are registered as DEPLOYED.
+     */
     public CompletableFuture<Void> observeAndRegisterStaticUnits() {
         Map<String, List<Version>> staticUnits = collectStaticUnits();
 
-
-
         return 
deploymentUnitStore.getNodeStatuses(nodeName).thenCompose(statuses -> {
             List<CompletableFuture<?>> futures = new ArrayList<>();
 
@@ -90,15 +105,15 @@ public class StaticDeploymentUnitObserver {
                                     return 
deploymentUnitStore.createNodeStatus(nodeName, id, version, status.opId(), 
DEPLOYED);
                                 }
                             })
-                            .whenComplete((result, t) -> LOG.info("Finished 
static status creating {}:{} with result {}", t, id, version, result));
+                            .whenComplete((result, t) ->
+                                    LOG.info("Finished static status creating 
{}:{} with result {}", t, id, version, result)
+                            );
                     futures.add(future);
                 });
             });
 
             return allOf(futures);
         });
-
-
     }
 
     private Map<String, List<Version>> collectStaticUnits() {
@@ -129,7 +144,8 @@ public class StaticDeploymentUnitObserver {
                 }
             });
         } catch (IOException e) {
-
+            LOG.error("Failed to collect static deployment unit folders.", e);
+            throw new DeploymentUnitReadException(e);
         }
         return subfolders;
     }
diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java
index 64b1c765252..16db19150e8 100644
--- 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java
@@ -26,7 +26,6 @@ import static 
org.apache.ignite.internal.metastorage.dsl.Conditions.revision;
 import static org.apache.ignite.internal.metastorage.dsl.Operations.noop;
 import static org.apache.ignite.internal.metastorage.dsl.Operations.put;
 import static org.apache.ignite.internal.metastorage.dsl.Operations.remove;
-import static org.apache.ignite.internal.metastorage.dsl.Statements.iif;
 import static 
org.apache.ignite.internal.util.CompletableFutures.falseCompletedFuture;
 
 import java.util.List;
diff --git 
a/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserverTest.java
 
b/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserverTest.java
index 4b7349a4624..2c96c5990b4 100644
--- 
a/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserverTest.java
+++ 
b/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StaticDeploymentUnitObserverTest.java
@@ -36,6 +36,9 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
+/**
+ * Test suite for {@link StaticDeploymentUnitObserver}.
+ */
 @ExtendWith(WorkDirectoryExtension.class)
 public class StaticDeploymentUnitObserverTest {
     private StaticDeploymentUnitObserver observer;
diff --git 
a/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StubDeploymentUnitStore.java
 
b/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StubDeploymentUnitStore.java
index dd4d83a5355..cde5cb071f1 100644
--- 
a/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StubDeploymentUnitStore.java
+++ 
b/modules/code-deployment/src/test/java/org/apache/ignite/internal/deployunit/StubDeploymentUnitStore.java
@@ -21,15 +21,12 @@ import static java.util.Collections.emptyList;
 import static java.util.concurrent.CompletableFuture.completedFuture;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
 import org.apache.ignite.deployment.version.Version;
 import 
org.apache.ignite.internal.deployunit.metastore.ClusterStatusWatchListener;
 import org.apache.ignite.internal.deployunit.metastore.DeploymentUnitStore;
@@ -37,6 +34,9 @@ import 
org.apache.ignite.internal.deployunit.metastore.NodeStatusWatchListener;
 import 
org.apache.ignite.internal.deployunit.metastore.status.UnitClusterStatus;
 import org.apache.ignite.internal.deployunit.metastore.status.UnitNodeStatus;
 
+/**
+ * Stub implementation of {@link DeploymentUnitStore}.
+ */
 public class StubDeploymentUnitStore implements DeploymentUnitStore {
     private final Map<String, Map<Version, UnitClusterStatus>> clusterStore = 
new HashMap<>();
 

Reply via email to