ibessonov commented on code in PR #1976:
URL: https://github.com/apache/ignite-3/pull/1976#discussion_r1180307344


##########
modules/storage-api/src/test/java/org/apache/ignite/internal/storage/util/LockByRowIdTest.java:
##########
@@ -25,135 +25,97 @@
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
 import org.apache.ignite.internal.storage.RowId;
-import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 /**
- * Class for testing {@link ReentrantLockByRowId}.
+ * Class for testing {@link LockByRowId}.
  */
-public class ReentrantLockByRowIdTest {
-    private ReentrantLockByRowId lockByRowId;
+public class LockByRowIdTest {
+    private LockByRowId lockByRowId;
 
     @BeforeEach
     void setUp() {
-        lockByRowId = new ReentrantLockByRowId();
-    }
-
-    @AfterEach
-    void tearDown() {
-        lockByRowId.releaseAllLockByCurrentThread();
+        lockByRowId = new LockByRowId();
     }
 
     @Test
     void testSimple() {
         RowId rowId = new RowId(0);
 
-        lockByRowId.acquireLock(rowId);
-        lockByRowId.releaseLock(rowId);
+        lockByRowId.lock(rowId);
+        lockByRowId.unlockAll(rowId);
 
-        assertEquals(1, lockByRowId.inLock(rowId, () -> 1));
+        assertEquals(1, inLock(rowId, () -> 1));
     }
 
     @Test
     void testSimpleReEnter() {
         RowId rowId = new RowId(0);
 
-        lockByRowId.acquireLock(rowId);
-        lockByRowId.acquireLock(rowId);
-
-        lockByRowId.inLock(rowId, () -> {
-            lockByRowId.acquireLock(rowId);
-
-            lockByRowId.releaseLock(rowId);
-
-            return null;
-        });
+        lockByRowId.lock(rowId);
+        lockByRowId.lock(rowId);
 
-        lockByRowId.releaseLock(rowId);
-        lockByRowId.releaseLock(rowId);
+        lockByRowId.unlockAll(rowId);
     }
 
     @Test
     void testReleaseError() {
-        assertThrows(IllegalStateException.class, () -> 
lockByRowId.releaseLock(new RowId(0)));
+        assertThrows(IllegalStateException.class, () -> 
lockByRowId.unlockAll(new RowId(0)));
 
         RowId rowId = new RowId(0);
 
-        assertThat(runAsync(() -> lockByRowId.acquireLock(rowId)), 
willCompleteSuccessfully());
+        assertThat(runAsync(() -> lockByRowId.lock(rowId)), 
willCompleteSuccessfully());
 
-        assertThrows(IllegalMonitorStateException.class, () -> 
lockByRowId.releaseLock(rowId));
+        assertThrows(IllegalMonitorStateException.class, () -> 
lockByRowId.unlockAll(rowId));
     }
 
     @Test
     void testBlockSimple() {
         RowId rowId = new RowId(0);
 
-        lockByRowId.acquireLock(rowId);
-        lockByRowId.acquireLock(rowId);
+        lockByRowId.lock(rowId);
+        lockByRowId.lock(rowId);
 
         CompletableFuture<?> acquireLockFuture = runAsync(() -> {
-            lockByRowId.acquireLock(rowId);
-            lockByRowId.releaseLock(rowId);
+            lockByRowId.lock(rowId);
+            lockByRowId.unlockAll(rowId);
         });
 
         assertThat(acquireLockFuture, willTimeoutFast());
 
-        lockByRowId.releaseLock(rowId);
-
-        assertThat(acquireLockFuture, willTimeoutFast());
-
-        lockByRowId.releaseLock(rowId);
+        lockByRowId.unlockAll(rowId);
 
         assertThat(acquireLockFuture, willCompleteSuccessfully());
-
-        lockByRowId.acquireLock(rowId);
     }
 
     @Test
     void testBlockSupplier() {

Review Comment:
   I think you're right, I'll remove it



-- 
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