Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDisposeTransactionsWhenAsked() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDisposeTransactionsWhenAsked()
        {
            // Given
            KernelTransactions transactions = NewKernelTransactions();

            transactions.DisposeAll();

            KernelTransaction first    = GetKernelTransaction(transactions);
            KernelTransaction second   = GetKernelTransaction(transactions);
            KernelTransaction leftOpen = GetKernelTransaction(transactions);

            first.Close();
            second.Close();

            // When
            transactions.DisposeAll();

            // Then
            KernelTransaction postDispose = GetKernelTransaction(transactions);

            assertThat(postDispose, not(equalTo(first)));
            assertThat(postDispose, not(equalTo(second)));

            assertNotNull(leftOpen.ReasonIfTerminated);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void disposeAllMarksAllTransactionsForTermination() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DisposeAllMarksAllTransactionsForTermination()
        {
            KernelTransactions kernelTransactions = NewKernelTransactions();

            KernelTransaction tx1 = GetKernelTransaction(kernelTransactions);
            KernelTransaction tx2 = GetKernelTransaction(kernelTransactions);
            KernelTransaction tx3 = GetKernelTransaction(kernelTransactions);

            kernelTransactions.DisposeAll();

            assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_General.DatabaseUnavailable, tx1.ReasonIfTerminated.get());
            assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_General.DatabaseUnavailable, tx2.ReasonIfTerminated.get());
            assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_General.DatabaseUnavailable, tx3.ReasonIfTerminated.get());
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void transactionClosesUnderlyingStoreReaderWhenDisposed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TransactionClosesUnderlyingStoreReaderWhenDisposed()
        {
            StorageReader storeStatement1 = mock(typeof(StorageReader));
            StorageReader storeStatement2 = mock(typeof(StorageReader));
            StorageReader storeStatement3 = mock(typeof(StorageReader));

            KernelTransactions kernelTransactions = newKernelTransactions(mock(typeof(TransactionCommitProcess)), storeStatement1, storeStatement2, storeStatement3);

            // start and close 3 transactions from different threads
            StartAndCloseTransaction(kernelTransactions);
            Executors.newSingleThreadExecutor().submit(() => startAndCloseTransaction(kernelTransactions)).get();
            Executors.newSingleThreadExecutor().submit(() => startAndCloseTransaction(kernelTransactions)).get();

            kernelTransactions.DisposeAll();

            verify(storeStatement1).close();
            verify(storeStatement2).close();
            verify(storeStatement3).close();
        }