//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { DependencyResolver dependencyResolver = mock(typeof(DependencyResolver)); when(_datasource.DependencyResolver).thenReturn(dependencyResolver); when(dependencyResolver.ResolveDependency(typeof(LogicalTransactionStore))).thenReturn(_logicalTransactionStore); when(dependencyResolver.ResolveDependency(typeof(TransactionIdStore))).thenReturn(_transactionIdStore); when(_transactionIdStore.LastCommittedTransactionId).thenReturn(15L); _txPullRequestHandler = new TxPullRequestHandler(new CatchupServerProtocol(), () => _storeId, () => true, () => _datasource, new Monitors(), _logProvider); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotStreamTxsAndReportErrorIfTheLocalDatabaseIsNotAvailable() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotStreamTxsAndReportErrorIfTheLocalDatabaseIsNotAvailable() { // given when(_transactionIdStore.LastCommittedTransactionId).thenReturn(15L); TxPullRequestHandler txPullRequestHandler = new TxPullRequestHandler(new CatchupServerProtocol(), () => _storeId, () => false, () => _datasource, new Monitors(), _logProvider); // when txPullRequestHandler.ChannelRead0(_context, new TxPullRequest(1, _storeId)); // then verify(_context).write(ResponseMessageType.TX_STREAM_FINISHED); verify(_context).writeAndFlush(new TxStreamFinishedResponse(E_STORE_UNAVAILABLE, 15L)); _logProvider.assertAtLeastOnce(inLog(typeof(TxPullRequestHandler)).info("Failed to serve TxPullRequest for tx %d because the local database is unavailable.", 2L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotStreamTxEntriesIfStoreIdMismatches() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotStreamTxEntriesIfStoreIdMismatches() { // given StoreId serverStoreId = new StoreId(1, 2, 3, 4); StoreId clientStoreId = new StoreId(5, 6, 7, 8); TxPullRequestHandler txPullRequestHandler = new TxPullRequestHandler(new CatchupServerProtocol(), () => serverStoreId, () => true, () => _datasource, new Monitors(), _logProvider); // when txPullRequestHandler.ChannelRead0(_context, new TxPullRequest(1, clientStoreId)); // then verify(_context).write(ResponseMessageType.TX_STREAM_FINISHED); verify(_context).writeAndFlush(new TxStreamFinishedResponse(E_STORE_ID_MISMATCH, 15L)); _logProvider.assertAtLeastOnce(inLog(typeof(TxPullRequestHandler)).info("Failed to serve TxPullRequest for tx %d and storeId %s because that storeId is different " + "from this machine with %s", 2L, clientStoreId, serverStoreId)); }