Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotFindTransactionLogPosition() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotFindTransactionLogPosition()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(txId, logEntryReader);
            PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(_txId, _logEntryReader);

            when(_logEntryReader.readLogEntry(_channel)).thenReturn(_start, _command, null);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final boolean result = locator.visit(channel);
            bool result = locator.Visit(_channel);

            // then
            assertTrue(result);
            try
            {
                locator.GetAndCacheFoundLogPosition(_metadataCache);
                fail("should have thrown");
            }
            catch (NoSuchTransactionException e)
            {
                assertEquals("Unable to find transaction " + _txId + " in any of my logical logs", e.Message);
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindTransactionLogPosition() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindTransactionLogPosition()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(txId, logEntryReader);
            PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(_txId, _logEntryReader);

            when(_logEntryReader.readLogEntry(_channel)).thenReturn(_start, _command, _commit, null);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final boolean result = locator.visit(channel);
            bool result = locator.Visit(_channel);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LogPosition position = locator.getAndCacheFoundLogPosition(metadataCache);
            LogPosition position = locator.GetAndCacheFoundLogPosition(_metadataCache);

            // then
            assertFalse(result);
            assertEquals(_startPosition, position);
            verify(_metadataCache, times(1)).cacheTransactionMetadata(_txId, _startPosition, _start.MasterId, _start.LocalId, LogEntryStart.checksum(_start), _commit.TimeWritten);
        }