コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseXForwardedHostHeaderWhenPresent()
        public virtual void ShouldUseXForwardedHostHeaderWhenPresent()
        {
            // when
            ClientResponse response = _client.resource(ManageUri).accept(APPLICATION_JSON).header(X_FORWARDED_HOST, "jimwebber.org").get(typeof(ClientResponse));

            // then
            string entity = response.getEntity(typeof(string));

            assertTrue(entity.Contains("http://jimwebber.org"));
            assertFalse(entity.Contains("http://localhost"));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRequireAuthorizationForHAStatusEndpoints() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRequireAuthorizationForHAStatusEndpoints()
        {
            // Given
            int       clusterPort = PortAuthority.allocatePort();
            NeoServer server      = EnterpriseServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").usingDataDir(Folder.Root.AbsolutePath).withProperty(mode.name(), "HA").withProperty(server_id.name(), "1").withProperty(cluster_server.name(), ":" + clusterPort).withProperty(initial_hosts.name(), ":" + clusterPort).persistent().build();

            try
            {
                server.Start();
                server.Database;

                assertThat(server.Database.Graph, @is(instanceOf(typeof(HighlyAvailableGraphDatabase))));

                Client         client = Client.create();
                ClientResponse r      = client.resource(GetHaEndpoint(server)).accept(APPLICATION_JSON).get(typeof(ClientResponse));
                assertEquals(401, r.Status);
            }
            finally
            {
                server.Stop();
            }
        }