use of org.neo4j.kernel.impl.api.TestKernelTransactionHandle in project neo4j by neo4j.
the class TransactionDependenciesResolverTest method detectBlockedTransactionsBySharedLock.
@Test
void detectBlockedTransactionsBySharedLock() {
HashMap<KernelTransactionHandle, Optional<QuerySnapshot>> map = new HashMap<>();
TestKernelTransactionHandle handle1 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction(), 0, singletonList(new ActiveLock(ResourceTypes.NODE, SHARED, 1, 1)));
TestKernelTransactionHandle handle2 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());
map.put(handle1, Optional.of(createQuerySnapshot(1)));
map.put(handle2, Optional.of(createQuerySnapshotWaitingForLock(2, EXCLUSIVE, ResourceTypes.NODE, 1, 1)));
TransactionDependenciesResolver resolver = new TransactionDependenciesResolver(map);
assertFalse(resolver.isBlocked(handle1));
assertTrue(resolver.isBlocked(handle2));
}
Aggregations