Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldForwardLockIdentifierToMaster() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldForwardLockIdentifierToMaster()
        {
            // Given
            when(_master.commit(_requestContext, _tx)).thenReturn(_response);

            // When
            _commitProcess.commit(new TransactionToApply(_tx), CommitEvent.NULL, TransactionApplicationMode.INTERNAL);

            // Then
            assertThat(_lastSeenEventIdentifier.get(), @is(1337));
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            if (batch.Next() != null)
            {
                throw new System.ArgumentException("Only supports single-commit on slave --> master");
            }

            try
            {
                TransactionRepresentation representation = batch.TransactionRepresentation();
                RequestContext            context        = _requestContextFactory.newRequestContext(representation.LockSessionId);
                using (Response <long> response = _master.commit(context, representation))
                {
                    return(response.ResponseConflict());
                }
            }
            catch (ComException e)
            {
                throw new TransientTransactionFailureException("Cannot commit this transaction on the master. " + "The master is either down, or we have network connectivity problems.", e);
            }
        }