예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseXForwardedProtoHeaderWhenPresent()
        public virtual void ShouldUseXForwardedProtoHeaderWhenPresent()
        {
            // when
            ClientResponse response = _client.resource(ManageUri).accept(APPLICATION_JSON).header(X_FORWARDED_PROTO, "https").get(typeof(ClientResponse));

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

            assertTrue(entity.Contains("https://localhost"));
            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 shouldUseXForwardedHostAndXForwardedProtoHeadersInCypherResponseRepresentations()
        public virtual void ShouldUseXForwardedHostAndXForwardedProtoHeadersInCypherResponseRepresentations()
        {
            // when
            string jsonString = "{\"statements\" : [{ \"statement\": \"MATCH (n) RETURN n\", " +
                                "\"resultDataContents\":[\"REST\"] }] }";

            ClientResponse response = _client.resource(ServerUri + "db/data/transaction").accept(APPLICATION_JSON).header(X_FORWARDED_HOST, "jimwebber.org:2354").header(X_FORWARDED_PROTO, "https").entity(jsonString, MediaType.APPLICATION_JSON_TYPE).post(typeof(ClientResponse));

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

            assertTrue(entity.Contains("https://jimwebber.org:2354"));
            assertFalse(entity.Contains(ServerUri));
        }
예제 #3
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();
            }
        }