示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void detectBlockedTransactionsBySharedLock()
        public virtual void DetectBlockedTransactionsBySharedLock()
        {
            Dictionary <KernelTransactionHandle, IList <QuerySnapshot> > map = new Dictionary <KernelTransactionHandle, IList <QuerySnapshot> >();
            TestKernelTransactionHandle handle1 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction(), 0, singletonList(ActiveLock.sharedLock(ResourceTypes.NODE, 1)));
            TestKernelTransactionHandle handle2 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());

            map[handle1] = singletonList(CreateQuerySnapshot(1));
            map[handle2] = singletonList(CreateQuerySnapshotWaitingForLock(2, true, ResourceTypes.NODE, 1));
            TransactionDependenciesResolver resolver = new TransactionDependenciesResolver(map);

            assertFalse(resolver.IsBlocked(handle1));
            assertTrue(resolver.IsBlocked(handle2));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void blockingChainDescriptionForDirectlyBlockedTransaction()
        public virtual void BlockingChainDescriptionForDirectlyBlockedTransaction()
        {
            Dictionary <KernelTransactionHandle, IList <QuerySnapshot> > map = new Dictionary <KernelTransactionHandle, IList <QuerySnapshot> >();
            TestKernelTransactionHandle handle1 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction(), 3, singletonList(ActiveLock.exclusiveLock(ResourceTypes.NODE, 1)));
            TestKernelTransactionHandle handle2 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());

            map[handle1] = singletonList(CreateQuerySnapshot(1));
            map[handle2] = singletonList(CreateQuerySnapshotWaitingForLock(2, false, ResourceTypes.NODE, 1));
            TransactionDependenciesResolver resolver = new TransactionDependenciesResolver(map);

            assertThat(resolver.DescribeBlockingTransactions(handle1), EmptyString);
            assertEquals("[transaction-3]", resolver.DescribeBlockingTransactions(handle2));
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void detectIndependentTransactionsAsNotBlocked()
        public virtual void DetectIndependentTransactionsAsNotBlocked()
        {
            Dictionary <KernelTransactionHandle, IList <QuerySnapshot> > map = new Dictionary <KernelTransactionHandle, IList <QuerySnapshot> >();
            TestKernelTransactionHandle handle1 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());
            TestKernelTransactionHandle handle2 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());

            map[handle1] = singletonList(CreateQuerySnapshot(1));
            map[handle2] = singletonList(CreateQuerySnapshot(2));
            TransactionDependenciesResolver resolver = new TransactionDependenciesResolver(map);

            assertFalse(resolver.IsBlocked(handle1));
            assertFalse(resolver.IsBlocked(handle2));
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void blockingChainDescriptionForIndependentTransactionsIsEmpty()
        public virtual void BlockingChainDescriptionForIndependentTransactionsIsEmpty()
        {
            Dictionary <KernelTransactionHandle, IList <QuerySnapshot> > map = new Dictionary <KernelTransactionHandle, IList <QuerySnapshot> >();
            TestKernelTransactionHandle handle1 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());
            TestKernelTransactionHandle handle2 = new TestKernelTransactionHandleWithLocks(new StubKernelTransaction());

            map[handle1] = singletonList(CreateQuerySnapshot(1));
            map[handle2] = singletonList(CreateQuerySnapshot(2));
            TransactionDependenciesResolver resolver = new TransactionDependenciesResolver(map);

            assertThat(resolver.DescribeBlockingTransactions(handle1), EmptyString);
            assertThat(resolver.DescribeBlockingTransactions(handle2), EmptyString);
        }