private void VerifySectionReportedCorrectly(AssertableLogProvider logProvider) { logProvider.FormattedMessageMatcher().assertContains(VisibleMigrationProgressMonitor.MESSAGE_STARTED); for (int i = 10; i <= 100; i += 10) { logProvider.FormattedMessageMatcher().assertContains(i + "%"); } logProvider.AssertNone(AssertableLogProvider.inLog(typeof(VisibleMigrationProgressMonitor)).info(containsString("110%"))); logProvider.FormattedMessageMatcher().assertContains(VisibleMigrationProgressMonitor.MESSAGE_COMPLETED); }
//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.")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldComplainIfServerPortIsAlreadyTaken() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldComplainIfServerPortIsAlreadyTaken() { using (ServerSocket socket = new ServerSocket(0, 0, InetAddress.LocalHost)) { ListenSocketAddress contestedAddress = new ListenSocketAddress(socket.InetAddress.HostName, socket.LocalPort); AssertableLogProvider logProvider = new AssertableLogProvider(); CommunityNeoServer server = CommunityServerBuilder.server(logProvider).onAddress(contestedAddress).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); try { server.Start(); fail("Should have reported failure to start"); } catch (ServerStartupException e) { assertThat(e.Message, containsString("Starting Neo4j failed")); } logProvider.AssertAtLeastOnce(AssertableLogProvider.inLog(containsString("CommunityNeoServer")).error("Failed to start Neo4j on %s: %s", contestedAddress, format("Address %s is already in use, cannot bind to it.", contestedAddress))); server.Stop(); } }
private void AssertWarning(string implementationName) { _logProvider.assertExactly(AssertableLogProvider.inLog(this.GetType()).warn("Using default tracer implementations instead of '%s'", implementationName)); }