예제 #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));
            }
        }