public virtual CompositeEventReporter Build() { CompositeEventReporter reporter = new CompositeEventReporter(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String prefix = createMetricsPrefix(config); string prefix = CreateMetricsPrefix(_config); if (_config.get(csvEnabled)) { CsvOutput csvOutput = new CsvOutput(_config, _registry, _logger, _kernelContext, _fileSystem, _scheduler); reporter.Add(csvOutput); _life.add(csvOutput); } if (_config.get(graphiteEnabled)) { HostnamePort server = _config.get(graphiteServer); long period = _config.get(graphiteInterval).toMillis(); GraphiteOutput graphiteOutput = new GraphiteOutput(server, period, _registry, _logger, prefix); reporter.Add(graphiteOutput); _life.add(graphiteOutput); } if (_config.get(prometheusEnabled)) { HostnamePort server = _config.get(prometheusEndpoint); PrometheusOutput prometheusOutput = new PrometheusOutput(server, _registry, _logger, _portRegister); reporter.Add(prometheusOutput); _life.add(prometheusOutput); } return(reporter); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private String httpsUri() throws Exception private string HttpsUri() { HostnamePort hostPort = AddressForConnector("https"); assertNotNull(hostPort); return((new URIBuilder()).setScheme("https").setHost(hostPort.Host).setPort(hostPort.Port).build().ToString()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public TransportConnection connect(org.neo4j.helpers.HostnamePort address) throws java.io.IOException public override TransportConnection Connect(HostnamePort address) { _socket.SoTimeout = 30000 * 1000; // TOOD _socket.connect(new InetSocketAddress(address.Host, address.Port)); @in = _socket.InputStream; @out = _socket.OutputStream; return(this); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSupportMultipleConnectors() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSupportMultipleConnectors() { HostnamePort address0 = Server.lookupConnector(DEFAULT_CONNECTOR_KEY); AssertConnectionAccepted(address0, NewConnection()); HostnamePort address1 = Server.lookupConnector(ANOTHER_CONNECTOR_KEY); AssertConnectionRejected(address1, NewConnection()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void noPortResolvesToDefault_ha() public virtual void NoPortResolvesToDefaultHa() { // given int?portIsNotSupplied = null; // when HostnamePort resolved = Subject.resolveCorrectHAAddress(DefaultConfig, new OptionalHostnamePort("localhost", portIsNotSupplied, null)); // then assertEquals(6362, resolved.Port); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void suppliedPortResolvesToGiven_ha() public virtual void SuppliedPortResolvesToGivenHa() { // given int?portIsSupplied = 1234; // when HostnamePort resolved = Subject.resolveCorrectHAAddress(DefaultConfig, new OptionalHostnamePort("localhost", portIsSupplied, null)); // then assertEquals(resolved.Port, portIsSupplied.Value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldExposeBaseUriWhenHttpDisabledAndHttpsEnabled() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldExposeBaseUriWhenHttpDisabledAndHttpsEnabled() { StartServer(false, true); URI uri = _server.baseUri(); assertEquals("https", uri.Scheme); HostnamePort expectedHostPort = AddressForConnector("https"); assertEquals(expectedHostPort.Host, uri.Host); assertEquals(expectedHostPort.Port, uri.Port); }
public override void Start() { if (!_config.get(UdcSettings.udc_enabled)) { return; } int firstDelay = _config.get(UdcSettings.first_delay); int interval = _config.get(UdcSettings.interval); HostnamePort hostAddress = _config.get(UdcSettings.udc_host); UdcInformationCollector collector = new DefaultUdcInformationCollector(_config, _dataSourceManager, _usageData); UdcTimerTask task = new UdcTimerTask(hostAddress, collector); _timer.scheduleAtFixedRate(task, firstDelay, interval); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPickUpAddressFromConfig() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPickUpAddressFromConfig() { ListenSocketAddress nonDefaultAddress = new ListenSocketAddress("0.0.0.0", 0); _server = _server().onAddress(nonDefaultAddress).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); HostnamePort localHttpAddress = LocalHttpAddress; assertNotEquals(HttpConnector.Encryption.NONE.defaultPort, localHttpAddress.Port); assertEquals(nonDefaultAddress.Hostname, localHttpAddress.Host); JaxRsResponse response = (new RestRequest(_server.baseUri())).get(); assertThat(response.Status, @is(200)); response.Close(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public Connection bindToFirstAvailablePortInRange(org.neo4j.helpers.HostnamePort serverAddress) throws org.jboss.netty.channel.ChannelException public virtual Connection BindToFirstAvailablePortInRange(HostnamePort serverAddress) { int[] ports = serverAddress.Ports; string host = serverAddress.Host; Channel channel; InetSocketAddress socketAddress; ChannelException lastException = null; PortIterator portIterator = new PortIterator(ports); while (portIterator.MoveNext()) { int?port = portIterator.Current; if (string.ReferenceEquals(host, null) || host.Equals(ALL_INTERFACES_ADDRESS)) { socketAddress = new InetSocketAddress(port); } else { socketAddress = new InetSocketAddress(host, port); } try { channel = _bootstrap.bind(socketAddress); return(new Connection(socketAddress, channel)); } catch (ChannelException e) { if (lastException != null) { e.addSuppressed(lastException); } lastException = e; } } throw Objects.requireNonNull(lastException); }
private void ShouldGatherForensicsInFullBackupRequest(bool forensics) { // GIVEN Response <Void> response = Response.empty(); StoreId storeId = response.StoreId; string host = "localhost"; int port = PortAuthority.allocatePort(); LifeSupport life = new LifeSupport(); LogEntryReader <ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); NullLogProvider logProvider = NullLogProvider.Instance; ResponseUnpacker responseUnpacker = mock(typeof(ResponseUnpacker)); ByteCounterMonitor byteCounterMonitor = mock(typeof(ByteCounterMonitor)); RequestMonitor requestMonitor = mock(typeof(RequestMonitor)); BackupClient client = new BackupClient(host, port, null, logProvider, storeId, 10_000, responseUnpacker, byteCounterMonitor, requestMonitor, reader); life.Add(client); ControlledBackupInterface backup = new ControlledBackupInterface(); HostnamePort hostnamePort = new HostnamePort(host, port); life.Add(new BackupServer(backup, hostnamePort, logProvider, byteCounterMonitor, requestMonitor)); life.Start(); try { // WHEN StoreWriter writer = mock(typeof(StoreWriter)); client.FullBackup(writer, forensics); // THEN assertEquals(forensics, backup.ReceivedForensics); } finally { life.Shutdown(); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private static Configuration newBackupConfig(final int chunkSize, final org.neo4j.helpers.HostnamePort server) private static Configuration NewBackupConfig(int chunkSize, HostnamePort server) { return(new ConfigurationAnonymousInnerClass(chunkSize, server)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void assertConnectionAccepted(org.neo4j.helpers.HostnamePort address, org.neo4j.bolt.v1.transport.socket.client.TransportConnection client) throws Exception private void AssertConnectionAccepted(HostnamePort address, TransportConnection client) { client.Connect(address).send(Util.defaultAcceptedVersions()).send(Util.chunk(new InitMessage("TestClient/1.1", emptyMap()))); assertThat(client, Util.eventuallyReceivesSelectedProtocolVersion()); }
public ConfigurationAnonymousInnerClass(int chunkSize, HostnamePort server) { this._chunkSize = chunkSize; this._server = server; }
internal virtual HostnamePort ResolveCorrectHAAddress(Config config, OptionalHostnamePort userProvidedAddress) { HostnamePort defaultValues = ReadDefaultConfigAddressHA(config); return(new HostnamePort(userProvidedAddress.Hostname.orElse(defaultValues.Host), userProvidedAddress.Port.GetValueOrDefault(defaultValues.Port))); }
private AdvertisedSocketAddress AsAdvertised(HostnamePort listenSocketAddress) { return(new AdvertisedSocketAddress(listenSocketAddress.Host, listenSocketAddress.Port)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void assertConnectionRejected(org.neo4j.helpers.HostnamePort address, org.neo4j.bolt.v1.transport.socket.client.TransportConnection client) throws Exception private void AssertConnectionRejected(HostnamePort address, TransportConnection client) { client.Connect(address).send(Util.defaultAcceptedVersions()); assertThat(client, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: public BackupServer(org.neo4j.backup.TheBackupInterface requestTarget, final org.neo4j.helpers.HostnamePort server, org.neo4j.logging.LogProvider logProvider, org.neo4j.kernel.monitoring.ByteCounterMonitor byteCounterMonitor, org.neo4j.com.monitor.RequestMonitor requestMonitor) public BackupServer(TheBackupInterface requestTarget, HostnamePort server, LogProvider logProvider, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor) : base(requestTarget, NewBackupConfig(FrameLength, server), logProvider, FrameLength, BackupProtocolVersion, ALWAYS_MATCH, Clocks.systemClock(), byteCounterMonitor, requestMonitor) { }