xtern commented on a change in pull request #9422:
URL: https://github.com/apache/ignite/pull/9422#discussion_r795602893



##########
File path: 
modules/control-utility/src/test/java/org/apache/ignite/util/SystemViewCommandTest.java
##########
@@ -1108,6 +1111,18 @@ public void testDistributedMetastorage() throws 
Exception {
             getTestTimeout()));
     }
 
+    /** */
+    @Test
+    public void testSnapshotView() throws Exception {
+        int srvCnt = (int)G.allGrids().stream().filter(n -> 
!n.configuration().isClientMode()).count();

Review comment:
       ```suggestion
           int srvCnt = ignite0.cluster().forServers().nodes().size();
   ```

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
##########
@@ -2044,6 +2048,53 @@ public void testBaselineNodeAttributes() throws 
Exception {
         }
     }
 
+    /** */
+    @Test
+    public void testSnapshot() throws Exception {
+        cleanPersistenceDir();
+
+        String dfltCacheGrp = "testGroup";
+
+        String testSnap0 = "testSnap0";
+        String testSnap1 = "testSnap1";
+
+        try (IgniteEx ignite = startGrid(getConfiguration()
+            .setCacheConfiguration(new 
CacheConfiguration<>(DEFAULT_CACHE_NAME).setGroupName(dfltCacheGrp))
+            .setDataStorageConfiguration(
+                new 
DataStorageConfiguration().setDefaultDataRegionConfiguration(
+                    new 
DataRegionConfiguration().setName("pds").setPersistenceEnabled(true)
+                )))
+        ) {
+            ignite.cluster().state(ClusterState.ACTIVE);
+
+            ignite.cache(DEFAULT_CACHE_NAME).put(1, 1);
+
+            ignite.snapshot().createSnapshot(testSnap0).get();
+
+            SystemView<SnapshotView> views = 
ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+            assertEquals(1, views.size());
+
+            SnapshotView view = F.first(views);
+
+            assertEquals(testSnap0, view.snapshotName());
+            assertEquals(toStringSafe(ignite.localNode().consistentId()), 
view.nodeId());
+
+            List<?> constIds = 
ignite.cluster().nodes().stream().map(ClusterNode::consistentId).collect(Collectors.toList());

Review comment:
       ```suggestion
               List<?> constIds = F.nodeConsistentIds(ignite.cluster().nodes());
   ```

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
##########
@@ -2044,6 +2048,53 @@ public void testBaselineNodeAttributes() throws 
Exception {
         }
     }
 
+    /** */
+    @Test
+    public void testSnapshot() throws Exception {
+        cleanPersistenceDir();

Review comment:
       redundant call

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
##########
@@ -2044,6 +2048,53 @@ public void testBaselineNodeAttributes() throws 
Exception {
         }
     }
 
+    /** */
+    @Test
+    public void testSnapshot() throws Exception {
+        cleanPersistenceDir();
+
+        String dfltCacheGrp = "testGroup";
+
+        String testSnap0 = "testSnap0";
+        String testSnap1 = "testSnap1";
+
+        try (IgniteEx ignite = startGrid(getConfiguration()
+            .setCacheConfiguration(new 
CacheConfiguration<>(DEFAULT_CACHE_NAME).setGroupName(dfltCacheGrp))
+            .setDataStorageConfiguration(
+                new 
DataStorageConfiguration().setDefaultDataRegionConfiguration(
+                    new 
DataRegionConfiguration().setName("pds").setPersistenceEnabled(true)
+                )))
+        ) {
+            ignite.cluster().state(ClusterState.ACTIVE);
+
+            ignite.cache(DEFAULT_CACHE_NAME).put(1, 1);
+
+            ignite.snapshot().createSnapshot(testSnap0).get();
+
+            SystemView<SnapshotView> views = 
ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+            assertEquals(1, views.size());
+
+            SnapshotView view = F.first(views);
+
+            assertEquals(testSnap0, view.snapshotName());
+            assertEquals(toStringSafe(ignite.localNode().consistentId()), 
view.nodeId());
+
+            List<?> constIds = 
ignite.cluster().nodes().stream().map(ClusterNode::consistentId).collect(Collectors.toList());
+
+            assertEquals(toStringSafe(constIds), view.baselineNodes());
+            assertEquals(toStringSafe(Arrays.asList(dfltCacheGrp, 
METASTORAGE_CACHE_NAME)), view.cacheGroups());

Review comment:
       Re-check this test.

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
##########
@@ -2044,6 +2048,53 @@ public void testBaselineNodeAttributes() throws 
Exception {
         }
     }
 
+    /** */
+    @Test
+    public void testSnapshot() throws Exception {
+        cleanPersistenceDir();
+
+        String dfltCacheGrp = "testGroup";
+
+        String testSnap0 = "testSnap0";
+        String testSnap1 = "testSnap1";
+
+        try (IgniteEx ignite = startGrid(getConfiguration()
+            .setCacheConfiguration(new 
CacheConfiguration<>(DEFAULT_CACHE_NAME).setGroupName(dfltCacheGrp))
+            .setDataStorageConfiguration(
+                new 
DataStorageConfiguration().setDefaultDataRegionConfiguration(
+                    new 
DataRegionConfiguration().setName("pds").setPersistenceEnabled(true)
+                )))
+        ) {
+            ignite.cluster().state(ClusterState.ACTIVE);
+
+            ignite.cache(DEFAULT_CACHE_NAME).put(1, 1);
+
+            ignite.snapshot().createSnapshot(testSnap0).get();
+
+            SystemView<SnapshotView> views = 
ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+            assertEquals(1, views.size());
+
+            SnapshotView view = F.first(views);
+
+            assertEquals(testSnap0, view.snapshotName());
+            assertEquals(toStringSafe(ignite.localNode().consistentId()), 
view.nodeId());
+
+            List<?> constIds = 
ignite.cluster().nodes().stream().map(ClusterNode::consistentId).collect(Collectors.toList());
+
+            assertEquals(toStringSafe(constIds), view.baselineNodes());
+            assertEquals(toStringSafe(Arrays.asList(dfltCacheGrp, 
METASTORAGE_CACHE_NAME)), view.cacheGroups());
+
+            ignite.createCache("testCache");
+
+            ignite.snapshot().createSnapshot(testSnap1).get();
+
+            views = ignite.context().systemView().view(SNAPSHOT_SYS_VIEW);
+
+            assertEquals(2, views.size());

Review comment:
       ```suggestion
               assertEquals(2, views.size());
   
               List<String> exp = new ArrayList<>(F.asList(testSnap0, 
testSnap1));
   
               views.forEach(v -> assertTrue(exp.remove(v.snapshotName())));
   
               assertTrue(exp.isEmpty());
   ```

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/managers/systemview/walker/SnapshotViewWalker.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.managers.systemview.walker;
+
+import org.apache.ignite.spi.systemview.view.SnapshotView;
+import org.apache.ignite.spi.systemview.view.SystemViewRowAttributeWalker;
+
+/**
+ * Generated by {@code 
org.apache.ignite.codegen.SystemViewRowAttributeWalkerGenerator}.
+ * {@link SnapshotView} attributes walker.
+ *
+ * @see SnapshotView
+ */
+public class SnapshotViewWalker implements 
SystemViewRowAttributeWalker<SnapshotView> {

Review comment:
       SystemViewRowAttributeWalkerGenerator generates another class, check, 
please.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to