//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void serverShouldNotHangWithThreadPoolSizeSmallerThanCpuCount() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ServerShouldNotHangWithThreadPoolSizeSmallerThanCpuCount() { _server = serverOnRandomPorts().withMaxJettyThreads(3).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); assertThat(GET(_server.baseUri().ToString()).status(), @is(200)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void startServer(boolean httpEnabled, boolean httpsEnabled) throws Exception private void StartServer(bool httpEnabled, bool httpsEnabled) { CommunityServerBuilder serverBuilder = serverOnRandomPorts().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath); if (!httpEnabled) { serverBuilder.WithHttpDisabled(); } if (httpsEnabled) { serverBuilder.WithHttpsEnabled(); } _server = serverBuilder.Build(); _server.start(); // Because we are generating a non-CA-signed certificate, we need to turn off verification in the client. // This is ironic, since there is no proper verification on the CA side in the first place, but I digress. TrustManager[] trustAllCerts = new TrustManager[] { new InsecureTrustManager() }; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.DefaultSSLSocketFactory = sc.SocketFactory; }
//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 shouldDisableConsoleServiceWhenAskedTo() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldDisableConsoleServiceWhenAskedTo() { // Given _server = serverOnRandomPorts().withProperty(ServerSettings.console_module_enabled.name(), "false").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); // When & then assertEquals(404, (new RestRequest()).get(_server.baseUri().ToString() + "db/manage/server/console").Status); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldEnableConsoleServiceByDefault() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldEnableConsoleServiceByDefault() { // Given _server = serverOnRandomPorts().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); _server.start(); // When & then assertEquals(200, (new RestRequest()).get(_server.baseUri().ToString() + "db/manage/server/console").Status); }
//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); }
//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 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 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 TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHonorReallyLowSessionTimeout() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHonorReallyLowSessionTimeout() { // Given _server = serverOnRandomPorts().withProperty(ServerSettings.transaction_idle_timeout.name(), "1").build(); _server.start(); string tx = HTTP.POST(TxURI(), asList(map("statement", "CREATE (n)"))).location(); // When Thread.Sleep(1000 * 5); IDictionary <string, object> response = HTTP.POST(tx + "/commit").content(); // Then //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<java.util.Map<String, Object>> errors = (java.util.List<java.util.Map<String, Object>>) response.get("errors"); IList <IDictionary <string, object> > errors = (IList <IDictionary <string, object> >)response["errors"]; assertThat(errors[0]["code"], equalTo(TransactionNotFound.code().serialize())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldComplainIfServerPortIsAlreadyTaken() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldComplainIfServerPortIsAlreadyTaken() { using (ServerSocket socket = new ServerSocket(0, 0, InetAddress.LocalHost)) { ListenSocketAddress contestedAddress = new ListenSocketAddress(socket.InetAddress.HostName, socket.LocalPort); AssertableLogProvider logProvider = new AssertableLogProvider(); CommunityNeoServer server = CommunityServerBuilder.server(logProvider).onAddress(contestedAddress).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); try { server.Start(); fail("Should have reported failure to start"); } catch (ServerStartupException e) { assertThat(e.Message, containsString("Starting Neo4j failed")); } logProvider.AssertAtLeastOnce(AssertableLogProvider.inLog(containsString("CommunityNeoServer")).error("Failed to start Neo4j on %s: %s", contestedAddress, format("Address %s is already in use, cannot bind to it.", contestedAddress))); server.Stop(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void startServerWithBoltEnabled(String advertisedHost, int advertisedPort, String listenHost, int listenPort) throws java.io.IOException private void StartServerWithBoltEnabled(string advertisedHost, int advertisedPort, string listenHost, int listenPort) { _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")).advertised_address.name(), advertisedHost + ":" + advertisedPort).withProperty((new BoltConnector("bolt")).listen_address.name(), listenHost + ":" + listenPort).usingDataDir(TmpDir.Root.AbsolutePath).build(); _server.start(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void startServer(String hstsValue) throws Exception private void StartServer(string hstsValue) { _server = BuildServer(hstsValue); _server.start(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void startServer() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void StartServer() { _server = serverOnRandomPorts().withHttpsEnabled().withProperty("dbms.shell.enabled", "false").withProperty("dbms.security.auth_enabled", "false").withProperty(ServerSettings.maximum_response_header_size.name(), "5000").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build(); }