コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTerminateOutdatedTransactions() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTerminateOutdatedTransactions()
        {
            // given
            long safeZone                       = 10;
            int  txCount                        = 3;
            long firstCommitTimestamp           = 10;
            long commitTimestampInterval        = 2;
            TransactionBatchCommitter committer = NewBatchCommitter(safeZone);

            TransactionChain  chain = CreateTxChain(txCount, firstCommitTimestamp, commitTimestampInterval);
            long              timestampOutsideSafeZone = chain.Last.transactionRepresentation().LatestCommittedTxWhenStarted - safeZone - 1;
            KernelTransaction txToTerminate            = NewKernelTransaction(timestampOutsideSafeZone);
            KernelTransaction tx = NewKernelTransaction(firstCommitTimestamp - 1);

            when(_kernelTransactions.activeTransactions()).thenReturn(Iterators.asSet(NewHandle(txToTerminate), NewHandle(tx)));

            // when
            committer.Apply(chain.First, chain.Last);

            // then
            verify(txToTerminate).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.Outdated);
            verify(tx, never()).markForTermination(any());
            _logProvider.formattedMessageMatcher().assertContains("Marking transaction for termination");
            _logProvider.formattedMessageMatcher().assertContains("lastCommittedTxId:" + (BASE_TX_ID + txCount - 1));
        }
コード例 #2
0
 public override void Start()
 {
     this._obligationFulfiller = _dependencies.obligationFulfiller();
     this._log = _dependencies.logService().getInternalLog(typeof(BatchingResponseHandler));
     this._versionContextSupplier = _dependencies.versionContextSupplier();
     this._batchCommitter         = new TransactionBatchCommitter(_dependencies.kernelTransactions(), _idReuseSafeZoneTime, _dependencies.commitProcess(), _log);
     this._stopped = false;
 }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCommitLargeBatch() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCommitLargeBatch()
        {
            // given
            long safeZone = 10;
            TransactionBatchCommitter committer = NewBatchCommitter(safeZone);

            TransactionChain chain = CreateTxChain(100, 1, 10);

            // when
            committer.Apply(chain.First, chain.Last);

            // then
            verify(_commitProcess).commit(eq(chain.First), any(), eq(EXTERNAL));
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBlockTransactionsForSmallBatch() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotBlockTransactionsForSmallBatch()
        {
            // given
            long safeZone = 10;
            TransactionBatchCommitter committer = NewBatchCommitter(safeZone);

            TransactionChain chain = CreateTxChain(3, 1, 1);

            // when
            committer.Apply(chain.First, chain.Last);

            // then
            verify(_kernelTransactions, never()).blockNewTransactions();
            verify(_kernelTransactions, never()).unblockNewTransactions();
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBlockTransactionsForLargeBatch() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBlockTransactionsForLargeBatch()
        {
            // given
            long safeZone = 10;
            TransactionBatchCommitter committer = NewBatchCommitter(safeZone);

            TransactionChain chain = CreateTxChain(100, 1, 10);

            // when
            committer.Apply(chain.First, chain.Last);

            // then
            InOrder inOrder = inOrder(_kernelTransactions);

            inOrder.verify(_kernelTransactions).blockNewTransactions();
            inOrder.verify(_kernelTransactions).unblockNewTransactions();
        }