//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRetainLockWhileStreaming() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRetainLockWhileStreaming() { // given ChannelPromise channelPromise = _embeddedChannel.newPromise(); ChannelHandlerContext channelHandlerContext = mock(typeof(ChannelHandlerContext)); when(channelHandlerContext.writeAndFlush(any(typeof(PrepareStoreCopyResponse)))).thenReturn(channelPromise); ReentrantReadWriteLock @lock = new ReentrantReadWriteLock(); when(_neoStoreDataSource.StoreCopyCheckPointMutex).thenReturn(new StoreCopyCheckPointMutex(@lock)); PrepareStoreCopyRequestHandler subjectHandler = CreateHandler(); // and LongSet indexIds = LongSets.immutable.of(42); File[] files = new File[] { new File("file") }; long lastCheckpoint = 1; ConfigureProvidedStoreCopyFiles(new StoreResource[0], files, indexIds, lastCheckpoint); // when subjectHandler.ChannelRead0(channelHandlerContext, new PrepareStoreCopyRequest(_storeIdMatching)); // then assertEquals(1, @lock.ReadLockCount); // when channelPromise.setSuccess(); //then assertEquals(0, @lock.ReadLockCount); }
public override void Write(ChannelHandlerContext ctx, object msg, ChannelPromise promise) { if (msg is ByteBuf) { ctx.write(new BinaryWebSocketFrame(( ByteBuf )msg), promise); } else { ctx.write(msg, promise); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLetAllowedMessagesPass() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLetAllowedMessagesPass() { // when ChannelPromise promise = mock(typeof(ChannelPromise)); _gate.write(_ctx, _allowedMsg, promise); _gate.write(_ctx, _allowedMsg, promise); _gate.write(_ctx, _allowedMsg, promise); // then verify(_ctx, times(3)).write(_allowedMsg, promise); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGateMessages() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGateMessages() { // when ChannelPromise promise = mock(typeof(ChannelPromise)); _gate.write(_ctx, "A", promise); _gate.write(_ctx, "B", promise); _gate.write(_ctx, "C", promise); // then verify(_ctx, never()).write(any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldStillLetAllowedMessagePassAfterFailure() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldStillLetAllowedMessagePassAfterFailure() { // given ChannelPromise promise = mock(typeof(ChannelPromise)); _gate.userEventTriggered(_ctx, GateEvent.Failure); // when _gate.write(_ctx, _allowedMsg, promise); // then verify(_ctx).write(_allowedMsg, promise); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotLetGatedMessagesPassAfterFailure() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotLetGatedMessagesPassAfterFailure() { // given ChannelPromise promise = mock(typeof(ChannelPromise)); _gate.userEventTriggered(_ctx, GateEvent.Failure); // when _gate.write(_ctx, "A", promise); _gate.write(_ctx, "B", promise); _gate.write(_ctx, "C", promise); // then verify(_ctx, never()).write(any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLetGatedMessagesPassOnSuccess() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLetGatedMessagesPassOnSuccess() { // given ChannelPromise promiseA = mock(typeof(ChannelPromise)); ChannelPromise promiseB = mock(typeof(ChannelPromise)); ChannelPromise promiseC = mock(typeof(ChannelPromise)); _gate.write(_ctx, "A", promiseA); _gate.write(_ctx, "B", promiseB); _gate.write(_ctx, "C", promiseC); verify(_ctx, never()).write(any(), any()); // when _gate.userEventTriggered(_ctx, GateEvent.Success); // then InOrder inOrder = Mockito.inOrder(_ctx); inOrder.verify(_ctx).write("A", promiseA); inOrder.verify(_ctx).write("B", promiseB); inOrder.verify(_ctx).write("C", promiseC); inOrder.verify(_ctx, never()).write(any(), any()); }