Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldResetInExplicitTransactionWhileStatementIsRunningWhenValidated() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldResetInExplicitTransactionWhileStatementIsRunningWhenValidated()
        {
            KernelTransaction            transaction     = NewTimedOutTransaction();
            TransactionStateMachineV1SPI stateMachineSPI = NewTransactionStateMachineSPI(transaction);
            TransactionStateMachine      stateMachine    = NewTransactionStateMachine(stateMachineSPI);

            // start an explicit transaction
            stateMachine.BeginTransaction(null);
            assertThat(stateMachine.StateConflict, @is(TransactionStateMachine.State.ExplicitTransaction));
            assertNotNull(stateMachine.Ctx.currentTransaction);

            stateMachine.Run("RETURN 1", null);

            // verify transaction, which is timed out
            stateMachine.ValidateTransaction();

            assertThat(stateMachine.StateConflict, @is(TransactionStateMachine.State.AutoCommit));
            assertNull(stateMachine.Ctx.currentTransaction);
            assertNull(stateMachine.Ctx.currentResult);
            assertNull(stateMachine.Ctx.currentResultHandle);

            verify(transaction, times(1)).ReasonIfTerminated;
            verify(transaction, times(1)).failure();
            verify(transaction, times(1)).close();
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDoNothingInAutoCommitTransactionUponInitialisationWhenValidated() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldDoNothingInAutoCommitTransactionUponInitialisationWhenValidated()
        {
            KernelTransaction            transaction     = NewTimedOutTransaction();
            TransactionStateMachineV1SPI stateMachineSPI = NewTransactionStateMachineSPI(transaction);
            TransactionStateMachine      stateMachine    = NewTransactionStateMachine(stateMachineSPI);

            // We're in auto-commit state
            assertThat(stateMachine.StateConflict, @is(TransactionStateMachine.State.AutoCommit));
            assertNull(stateMachine.Ctx.currentTransaction);

            // call validate transaction
            stateMachine.ValidateTransaction();

            assertThat(stateMachine.StateConflict, @is(TransactionStateMachine.State.AutoCommit));
            assertNull(stateMachine.Ctx.currentTransaction);

            verify(transaction, never()).ReasonIfTerminated;
            verify(transaction, never()).failure();
            verify(transaction, never()).close();
        }