Beispiel #1
0
        private URI BoltURI()
        {
            ConnectorPortRegister connectorPortRegister = (( GraphDatabaseAPI )_db).DependencyResolver.resolveDependency(typeof(ConnectorPortRegister));
            HostnamePort          boltHostNamePort      = connectorPortRegister.GetLocalAddress("bolt");

            return(URI.create("bolt://" + boltHostNamePort.Host + ":" + boltHostNamePort.Port));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToSpecifyHostAndPort() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToSpecifyHostAndPort()
        {
            // When
            StartServerWithBoltEnabled();

            ConnectorPortRegister connectorPortRegister = GetDependency(typeof(ConnectorPortRegister));

            // Then
            AssertEventuallyServerResponds("localhost", connectorPortRegister.GetLocalAddress("bolt").Port);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLaunchBolt() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLaunchBolt()
        {
            // When I run Neo4j with Bolt enabled
            _server = serverOnRandomPorts().withProperty((new BoltConnector("bolt")).type.name(), "BOLT").withProperty((new BoltConnector("bolt")).enabled.name(), "true").withProperty((new BoltConnector("bolt")).encryption_level.name(), "REQUIRED").withProperty((new BoltConnector("bolt")).listen_address.name(), "localhost:0").usingDataDir(TmpDir.Root.AbsolutePath).build();
            _server.start();
            ConnectorPortRegister connectorPortRegister = GetDependency(typeof(ConnectorPortRegister));

            // Then
            AssertEventuallyServerResponds("localhost", connectorPortRegister.GetLocalAddress("bolt").Port);
        }
Beispiel #4
0
            public virtual Builder AddBoltConnectorFromConfig(string key, string scheme, Config config, Setting <URI> @override, ConnectorPortRegister portRegister)
            {
                // If an override is configured, add it with the HIGHEST precedence
                if (config.IsConfigured(@override))
                {
                    add(key, config.Get(@override), HIGHEST);
                }

                config.EnabledBoltConnectors().First().ifPresent(c =>
                {
                    AdvertisedSocketAddress address = config.Get(c.advertised_address);
                    int port = address.Port;
                    if (port == 0)
                    {
                        port = portRegister.GetLocalAddress(c.key()).Port;
                    }

                    // If advertised address is explicitly set, set the precedence to HIGH - eitherwise set it as LOWEST (default)
                    Add(key, scheme, address.Hostname, port, config.IsConfigured(c.advertised_address) ? HIGH : LOWEST);
                });

                return(this);
            }
Beispiel #5
0
        public static HostnamePort ConnectorAddress(GraphDatabaseService db, string name)
        {
            ConnectorPortRegister portRegister = (( GraphDatabaseAPI )db).DependencyResolver.resolveDependency(typeof(ConnectorPortRegister));

            return(portRegister.GetLocalAddress(name));
        }
Beispiel #6
0
		 private int GetBoltConnectorPort( GraphDatabaseAPI databaseAPI )
		 {
			  ConnectorPortRegister connectorPortRegister = databaseAPI.DependencyResolver.resolveDependency( typeof( ConnectorPortRegister ) );
			  return connectorPortRegister.GetLocalAddress( BOLT_CONNECTOR_KEY ).Port;
		 }