Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPackTheHighestTxCommittedAsObligation() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPackTheHighestTxCommittedAsObligation()
        {
            // GIVEN
            LogicalTransactionStore transactionStore = mock(typeof(LogicalTransactionStore));
            FileSystemAbstraction   fs = _fsRule.get();
            PageCache pageCache        = _pageCacheRule.getPageCache(fs);

            using (NeoStores neoStore = CreateNeoStore(fs, pageCache))
            {
                MetaDataStore store = neoStore.MetaDataStore;
                store.TransactionCommitted(2, 111, BASE_TX_COMMIT_TIMESTAMP);
                store.TransactionCommitted(3, 222, BASE_TX_COMMIT_TIMESTAMP);
                store.TransactionCommitted(4, 333, BASE_TX_COMMIT_TIMESTAMP);
                store.TransactionCommitted(5, 444, BASE_TX_COMMIT_TIMESTAMP);
                store.TransactionCommitted(6, 555, BASE_TX_COMMIT_TIMESTAMP);

                // skip 7 to emulate the fact we have an hole in the committed tx ids list

                const long expectedTxId = 8L;
                store.TransactionCommitted(expectedTxId, 777, BASE_TX_COMMIT_TIMESTAMP);

                ResponsePacker packer = new ResponsePacker(transactionStore, store, Suppliers.singleton(newStoreIdForCurrentVersion()));

                // WHEN
                Response <object> response = packer.PackTransactionObligationResponse(new RequestContext(0, 0, 0, 0, 0), new object());

                // THEN
                assertTrue(response is TransactionObligationResponse);
                (( TransactionObligationResponse )response).accept(new HandlerAnonymousInnerClass(this, expectedTxId));
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveFixedTargetTransactionIdEvenIfLastTransactionIdIsMoving() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHaveFixedTargetTransactionIdEvenIfLastTransactionIdIsMoving()
        {
            // GIVEN
            LogicalTransactionStore transactionStore = mock(typeof(LogicalTransactionStore));
            long lastAppliedTransactionId            = 5L;
            TransactionCursor endlessCursor          = new EndlessCursor(this, lastAppliedTransactionId + 1);

            when(transactionStore.getTransactions(anyLong())).thenReturn(endlessCursor);
            const long targetTransactionId = 8L;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.TransactionIdStore transactionIdStore = new org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore(targetTransactionId, 0, BASE_TX_COMMIT_TIMESTAMP, 0, 0);
            TransactionIdStore transactionIdStore = new SimpleTransactionIdStore(targetTransactionId, 0, BASE_TX_COMMIT_TIMESTAMP, 0, 0);
            ResponsePacker     packer             = new ResponsePacker(transactionStore, transactionIdStore, Suppliers.singleton(StoreIdTestFactory.newStoreIdForCurrentVersion()));

            // WHEN
            Response <object> response = packer.PackTransactionStreamResponse(RequestContextStartingAt(5L), null);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicLong nextExpectedVisit = new java.util.concurrent.atomic.AtomicLong(lastAppliedTransactionId);
            AtomicLong nextExpectedVisit = new AtomicLong(lastAppliedTransactionId);

            response.Accept(new HandlerAnonymousInnerClass(this, targetTransactionId, transactionIdStore, nextExpectedVisit));
        }