Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            _txApplier1 = mock(typeof(TransactionApplier));
            _applier1   = mock(typeof(BatchTransactionApplier));
            when(_applier1.startTx(any(typeof(TransactionToApply)))).thenReturn(_txApplier1);
            when(_applier1.startTx(any(typeof(TransactionToApply)), any(typeof(LockGroup)))).thenReturn(_txApplier1);

            _txApplier2 = mock(typeof(TransactionApplier));
            _applier2   = mock(typeof(BatchTransactionApplier));
            when(_applier2.startTx(any(typeof(TransactionToApply)))).thenReturn(_txApplier2);
            when(_applier2.startTx(any(typeof(TransactionToApply)), any(typeof(LockGroup)))).thenReturn(_txApplier2);

            _txApplier3 = mock(typeof(TransactionApplier));
            _applier3   = mock(typeof(BatchTransactionApplier));
            when(_applier3.startTx(any(typeof(TransactionToApply)))).thenReturn(_txApplier3);
            when(_applier3.startTx(any(typeof(TransactionToApply)), any(typeof(LockGroup)))).thenReturn(_txApplier3);

            _facade = new BatchTransactionApplierFacade(_applier1, _applier2, _applier3);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void apply(org.neo4j.storageengine.api.CommandsToApply batch, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws Exception
        public override void Apply(CommandsToApply batch, TransactionApplicationMode mode)
        {
            // Have these command appliers as separate try-with-resource to have better control over
            // point between closing this and the locks above
            try
            {
                using (IndexActivator indexActivator = new IndexActivator(_indexingService), LockGroup locks = new LockGroup(), BatchTransactionApplier batchApplier = Applier(mode, indexActivator))
                {
                    while (batch != null)
                    {
                        using (TransactionApplier txApplier = batchApplier.StartTx(batch, locks))
                        {
                            batch.Accept(txApplier);
                        }
                        batch = batch.Next();
                    }
                }
            }
            catch (Exception cause)
            {
                TransactionApplyKernelException kernelException = new TransactionApplyKernelException(cause, "Failed to apply transaction: %s", batch);
                _databaseHealth.panic(kernelException);
                throw kernelException;
            }
        }