//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void GivenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() { // given string directoryPrefix = _testName.MethodName; File logDirectory = _testDirectory.directory(directoryPrefix + "-logdir"); NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.FALSE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.ToString()).withProperty((new BoltConnector("bolt")).listen_address.name(), ":0").usingDataDir(_testDirectory.directory(directoryPrefix + "-dbdir").AbsolutePath).build(); try { server.Start(); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server); // when string query = "?implicitlyDisabled" + RandomString(); JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri() + query); assertThat(response.Status, @is(HttpStatus.SC_OK)); response.Close(); // then File httpLog = new File(logDirectory, "http.log"); assertThat(httpLog.exists(), @is(false)); } finally { server.Stop(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void givenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void GivenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess() { // given string directoryPrefix = _testName.MethodName; File logDirectory = _testDirectory.directory(directoryPrefix + "-logdir"); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String query = "?explicitlyEnabled=" + randomString(); string query = "?explicitlyEnabled=" + RandomString(); NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.TRUE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.AbsolutePath).withProperty((new BoltConnector("bolt")).listen_address.name(), ":0").usingDataDir(_testDirectory.directory(directoryPrefix + "-dbdir").AbsolutePath).build(); try { server.Start(); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server); // when JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri() + query); assertThat(response.Status, @is(HttpStatus.SC_OK)); response.Close(); // then File httpLog = new File(logDirectory, "http.log"); assertEventually("request appears in log", FileContentSupplier(httpLog), containsString(query), 5, TimeUnit.SECONDS); } finally { server.Stop(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotGenerateWADLWhenExplicitlyDisabledInConfig() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotGenerateWADLWhenExplicitlyDisabledInConfig() { _server = serverOnRandomPorts().withProperty(ServerSettings.wadl_enabled.name(), "false").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); JaxRsResponse response = (new RestRequest()).get(_server.baseUri().ToString() + "application.wadl", MediaType.WILDCARD_TYPE); assertEquals(404, response.Status); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDefaultToSensiblePortIfNoneSpecifiedInConfig() public virtual void ShouldDefaultToSensiblePortIfNoneSpecifiedInConfig() { FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(Server()); JaxRsResponse response = functionalTestHelper.Get(functionalTestHelper.ManagementUri()); assertThat(response.Status, @is(200)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateWADLWhenExplicitlyEnabledInConfig() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGenerateWADLWhenExplicitlyEnabledInConfig() { _server = serverOnRandomPorts().withProperty(ServerSettings.wadl_enabled.name(), "true").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); JaxRsResponse response = (new RestRequest()).get(_server.baseUri().ToString() + "application.wadl", MediaType.WILDCARD_TYPE); assertEquals(200, response.Status); assertEquals("application/vnd.sun.wadl+xml", response.Headers.get("Content-Type").GetEnumerator().next()); assertThat(response.Entity, containsString("<application xmlns=\"http://wadl.dev.java" + ".net/2009/02\">")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldMakeJAXRSClassesAvailableViaHTTP() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldMakeJAXRSClassesAvailableViaHTTP() { CommunityServerBuilder builder = CommunityServerBuilder.server(); _server = ServerHelper.createNonPersistentServer(builder); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(_server); JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri()); assertEquals(200, response.Status); response.Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRedirectToBrowserUsingXForwardedHeaders() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRedirectToBrowserUsingXForwardedHeaders() { Client nonRedirectingClient = Client.create(); nonRedirectingClient.FollowRedirects = false; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.server.rest.JaxRsResponse response = new org.neo4j.server.rest.RestRequest(server.baseUri(), nonRedirectingClient).accept(javax.ws.rs.core.MediaType.TEXT_HTML_TYPE).header("X-Forwarded-Host", "foo.bar:8734").header("X-Forwarded-Proto", "https").get(server.baseUri().toString()); JaxRsResponse response = (new RestRequest(_server.baseUri(), nonRedirectingClient)).accept(MediaType.TEXT_HTML_TYPE).header("X-Forwarded-Host", "foo.bar:8734").header("X-Forwarded-Proto", "https").get(_server.baseUri().ToString()); assertEquals(303, response.Status); assertEquals(new URI("https://foo.bar:8734/browser/"), response.Location); response.Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPickupRelativeUrisForManagementApiAndRestApi() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPickupRelativeUrisForManagementApiAndRestApi() { string dataUri = "a/different/data/uri/"; string managementUri = "a/different/management/uri/"; _server = serverOnRandomPorts().withRelativeRestApiUriPath("/" + dataUri).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).withRelativeManagementApiUriPath("/" + managementUri).build(); _server.start(); JaxRsResponse response = (new RestRequest()).get(_server.baseUri().ToString() + dataUri, MediaType.TEXT_HTML_TYPE); assertEquals(200, response.Status); response = (new RestRequest()).get(_server.baseUri().ToString() + managementUri); assertEquals(200, response.Status); response.Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogStartup() public virtual void ShouldLogStartup() { // Check the logs string logContent = @out.ToString(); assertThat(logContent.Length, @is(greaterThan(0))); assertThat(logContent, containsString(NEO4J_IS_STARTING_MESSAGE)); // Check the server is alive Client nonRedirectingClient = Client.create(); nonRedirectingClient.FollowRedirects = false; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.server.rest.JaxRsResponse response = new org.neo4j.server.rest.RestRequest(server.baseUri(), nonRedirectingClient).get(); JaxRsResponse response = (new RestRequest(_server.baseUri(), nonRedirectingClient)).get(); assertThat(response.Status, @is(greaterThan(199))); }
//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(); }