예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void should_flush()
        public virtual void ShouldFlush()
        {
            // GIVEN
            _stateStore.put("key", "created_value");

            // WHEN
            _stateStore.clear();

            // THEN
            string result = _stateStore.get("key");

            assertNull(result);

            // AND ALSO
            _logProvider.assertExactly(inLog(typeof(DatabaseSchemaState)).debug("Schema state store has been cleared."));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogAWarningIfThereIsNoDecoderForTheMessageType() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogAWarningIfThereIsNoDecoderForTheMessageType()
        {
            // given
            RequestDecoderDispatcher <State> dispatcher    = new RequestDecoderDispatcher <State>(protocol, _logProvider);
            ChannelInboundHandler            delegateOne   = mock(typeof(ChannelInboundHandler));
            ChannelInboundHandler            delegateThree = mock(typeof(ChannelInboundHandler));

            dispatcher.Register(State.One, delegateOne);
            dispatcher.Register(State.Three, delegateThree);

            // when
            dispatcher.ChannelRead(mock(typeof(ChannelHandlerContext)), new object());

            // then
            AssertableLogProvider.LogMatcher matcher = inLog(typeof(RequestDecoderDispatcher)).warn("Unregistered handler for protocol %s", protocol);

            _logProvider.assertExactly(matcher);
            verifyZeroInteractions(delegateOne, delegateThree);
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRejectIfHttp()
        public virtual void ShouldRejectIfHttp()
        {
            // Given
            BoltProtocol        protocol       = NewBoltProtocol(1);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true));

            // When
            FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "http://hello_world:10000");

            request.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, 0);
            channel.writeInbound(request);

            // Then
            assertEquals(0, channel.outboundMessages().size());
            assertFalse(channel.Active);
            verify(protocol, never()).install();
            _logProvider.assertExactly(AssertableLogProvider.inLog(typeof(ProtocolHandshaker)).warn("Unsupported connection type: 'HTTP'. Bolt protocol only operates over a TCP connection or WebSocket."));
        }
예제 #4
0
 private void AssertLogged(string name)
 {
     _log.assertExactly(inLog(this.GetType()).info(format("{plugin-%s} info line", name)), inLog(this.GetType()).warn(format("{plugin-%s} warn line", name)), inLog(this.GetType()).error(format("{plugin-%s} error line", name)));
 }
예제 #5
0
 private void AssertWarning(string implementationName)
 {
     _logProvider.assertExactly(AssertableLogProvider.inLog(this.GetType()).warn("Using default tracer implementations instead of '%s'", implementationName));
 }