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

agura 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 02d795cef IGNITE 17107 End-to-end test for persistent PageMemory
02d795cef is described below

commit 02d795cefabae3e713bd3ba2accd25a090d2a10c
Author: Kirill Tkalenko <tkalkir...@yandex.ru>
AuthorDate: Mon Jun 6 19:07:40 2022 +0300

    IGNITE 17107 End-to-end test for persistent PageMemory
    
    Signed-off-by: Andrey Gura <ag...@apache.org>
---
 examples/README.md                                 |  1 +
 ...st.java => ItPageMemoryStorageExampleTest.java} | 34 ++++++++++++++++------
 .../ignite/example/sql/jdbc/SqlJdbcExample.java    |  4 +--
 ...ava => PersistentPageMemoryStorageExample.java} | 14 ++++-----
 .../storage/VolatilePageMemoryStorageExample.java  |  4 +--
 .../ignite/example/table/KeyValueViewExample.java  |  4 +--
 .../example/table/KeyValueViewPojoExample.java     |  4 +--
 .../ignite/example/table/RecordViewExample.java    |  4 +--
 .../example/table/RecordViewPojoExample.java       |  4 +--
 .../ignite/example/tx/TransactionsExample.java     |  4 +--
 10 files changed, 47 insertions(+), 30 deletions(-)

diff --git a/examples/README.md b/examples/README.md
index 43a1678de..890753737 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -11,6 +11,7 @@ The following examples are included:
 * `SqlJdbcExample` - demonstrates the usage of the Apache Ignite JDBC driver.
 * `RebalanceExample` - demonstrates the data rebalancing process.
 * `VolatilePageMemoryStorageExample` - demonstrates the usage of the 
PageMemory storage engine configured with an in-memory data region.
+* `PersistentPageMemoryStorageExample` - demonstrates the usage of the 
PageMemory storage engine configured with a persistent data region.
 
 Before running the examples, read about 
[cli](https://ignite.apache.org/docs/3.0.0-alpha/ignite-cli-tool).
 
diff --git 
a/examples/src/integrationTest/java/org/apache/ignite/example/storage/ItVolatilePageMemoryStorageExampleTest.java
 
b/examples/src/integrationTest/java/org/apache/ignite/example/storage/ItPageMemoryStorageExampleTest.java
similarity index 58%
rename from 
examples/src/integrationTest/java/org/apache/ignite/example/storage/ItVolatilePageMemoryStorageExampleTest.java
rename to 
examples/src/integrationTest/java/org/apache/ignite/example/storage/ItPageMemoryStorageExampleTest.java
index fc60b0106..475b289f7 100644
--- 
a/examples/src/integrationTest/java/org/apache/ignite/example/storage/ItVolatilePageMemoryStorageExampleTest.java
+++ 
b/examples/src/integrationTest/java/org/apache/ignite/example/storage/ItPageMemoryStorageExampleTest.java
@@ -21,21 +21,30 @@ import static 
org.apache.ignite.example.ExampleTestUtils.assertConsoleOutputCont
 
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.example.AbstractExamplesTest;
+import org.apache.ignite.internal.storage.pagememory.PageMemoryStorageEngine;
 import 
org.apache.ignite.internal.storage.pagememory.configuration.schema.PageMemoryStorageEngineConfiguration;
 import org.junit.jupiter.api.Test;
 
 /**
- * For {@link VolatilePageMemoryStorageExample} testing.
+ * For testing examples demonstrating work with {@link 
PageMemoryStorageEngine}.
  */
-public class ItVolatilePageMemoryStorageExampleTest extends 
AbstractExamplesTest {
+public class ItPageMemoryStorageExampleTest extends AbstractExamplesTest {
     @Test
-    public void testExample() throws Exception {
-        ignite
-                .clusterConfiguration()
-                .getConfiguration(PageMemoryStorageEngineConfiguration.KEY)
-                .regions()
-                .change(regionsChange -> regionsChange.create("in-memory", 
regionChange -> regionChange.changePersistent(false)))
-                .get(1, TimeUnit.SECONDS);
+    public void testPersistentExample() throws Exception {
+        addDataRegionConfig("persistent", true);
+
+        assertConsoleOutputContains(PersistentPageMemoryStorageExample::main, 
EMPTY_ARGS,
+                "\nAll accounts:\n"
+                        + "    1, John, Doe, 1000.0\n"
+                        + "    2, Jane, Roe, 2000.0\n"
+                        + "    3, Mary, Major, 1500.0\n"
+                        + "    4, Richard, Miles, 1450.0\n"
+        );
+    }
+
+    @Test
+    public void testInMemoryExample() throws Exception {
+        addDataRegionConfig("in-memory", false);
 
         assertConsoleOutputContains(VolatilePageMemoryStorageExample::main, 
EMPTY_ARGS,
                 "\nAll accounts:\n"
@@ -45,4 +54,11 @@ public class ItVolatilePageMemoryStorageExampleTest extends 
AbstractExamplesTest
                         + "    4, Richard, Miles, 1450.0\n"
         );
     }
+
+    private void addDataRegionConfig(String name, boolean persistent) throws 
Exception {
+        
ignite.clusterConfiguration().getConfiguration(PageMemoryStorageEngineConfiguration.KEY)
+                .regions()
+                .change(regionsChange -> regionsChange.create(name, 
regionChange -> regionChange.changePersistent(persistent)))
+                .get(1, TimeUnit.SECONDS);
+    }
 }
diff --git 
a/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java 
b/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java
index 5265faf40..f873b879c 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java
@@ -34,7 +34,7 @@ import java.sql.Statement;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -43,7 +43,7 @@ import java.sql.Statement;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
 
b/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java
similarity index 93%
copy from 
examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
copy to 
examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java
index 834c35f69..5c1cbd6dc 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java
@@ -24,7 +24,7 @@ import java.sql.ResultSet;
 import java.sql.Statement;
 
 /**
- * This example demonstrates a usage of the PageMemory storage engine 
configured with an in-memory data region.
+ * This example demonstrates a usage of the PageMemory storage engine 
configured with a persistent data region.
  *
  * <p>To run the example, do the following:
  * <ol>
@@ -34,7 +34,7 @@ import java.sql.Statement;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -42,17 +42,17 @@ import java.sql.Statement;
  *         {@code ignite cluster init --cluster-name=ignite-cluster 
--node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
  *     </li>
  *     <li>
- *         Add configuration for in-memory data region of of the PageMemory 
storage engine using the CLI tool (if not done yet):<br>
- *         {@code ignite config set --type=cluster 
"pageMemory.regions.in-memory:{persistent=false}"}
+ *         Add configuration for persistent data region of of the PageMemory 
storage engine using the CLI tool (if not done yet):<br>
+ *         {@code ignite config set --type=cluster 
"pageMemory.regions.persistent:{persistent=true}"}
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
  */
-public class VolatilePageMemoryStorageExample {
+public class PersistentPageMemoryStorageExample {
     /**
      * Main method of the example.
      *
@@ -83,7 +83,7 @@ public class VolatilePageMemoryStorageExample {
                                 + "LAST_NAME  VARCHAR, "
                                 + "BALANCE    DOUBLE) "
                                 + "ENGINE pagememory "
-                                + "WITH dataRegion='in-memory'"
+                                + "WITH dataRegion='persistent'"
                 );
             }
 
diff --git 
a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
 
b/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
index 834c35f69..cebd65ca5 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java
@@ -34,7 +34,7 @@ import java.sql.Statement;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -47,7 +47,7 @@ import java.sql.Statement;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java
 
b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java
index af36ac483..a51e0a945 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java
@@ -35,7 +35,7 @@ import org.apache.ignite.table.Tuple;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -44,7 +44,7 @@ import org.apache.ignite.table.Tuple;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java
 
b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java
index 63eef2184..03fdc1f28 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java
@@ -34,7 +34,7 @@ import org.apache.ignite.table.KeyValueView;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -43,7 +43,7 @@ import org.apache.ignite.table.KeyValueView;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java 
b/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java
index 7b4613204..7d58366ee 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java
@@ -35,7 +35,7 @@ import org.apache.ignite.table.Tuple;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -44,7 +44,7 @@ import org.apache.ignite.table.Tuple;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java
 
b/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java
index 935b93b64..c41a10a2f 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java
@@ -34,7 +34,7 @@ import org.apache.ignite.table.RecordView;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -43,7 +43,7 @@ import org.apache.ignite.table.RecordView;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>
diff --git 
a/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java 
b/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java
index f88d2940a..c6018dd4a 100644
--- 
a/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java
@@ -36,7 +36,7 @@ import org.apache.ignite.tx.IgniteTransactions;
  *         {@code ignite init}
  *     </li>
  *     <li>
- *         Start a server node using the CLI tool:<br>
+ *         Start an Ignite node using the CLI tool:<br>
  *         {@code ignite node start 
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
  *     </li>
  *     <li>
@@ -45,7 +45,7 @@ import org.apache.ignite.tx.IgniteTransactions;
  *     </li>
  *     <li>Run the example in the IDE.</li>
  *     <li>
- *         Stop a server node using the CLI tool:<br>
+ *         Stop the Ignite node using the CLI tool:<br>
  *         {@code ignite node stop my-first-node}
  *     </li>
  * </ol>

Reply via email to