//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToStartInHAMode() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToStartInHAMode() { // Given int clusterPort = PortAuthority.allocatePort(); NeoServer server = EnterpriseServerBuilder.serverOnRandomPorts().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)))); HTTP.Response haEndpoint = HTTP.GET(GetHaEndpoint(server)); assertEquals(200, haEndpoint.Status()); assertThat(haEndpoint.RawContent(), containsString("master")); HTTP.Response discovery = HTTP.GET(server.BaseUri().toASCIIString()); assertEquals(200, discovery.Status()); } finally { server.Stop(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldShowServerMetrics() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldShowServerMetrics() { // Given File metrics = Folder.file("metrics"); NeoServer server = EnterpriseServerBuilder.serverOnRandomPorts().usingDataDir(Folder.databaseDir().AbsolutePath).withProperty(MetricsSettings.metricsEnabled.name(), "true").withProperty(MetricsSettings.csvEnabled.name(), "true").withProperty(MetricsSettings.csvPath.name(), metrics.Path).withProperty(MetricsSettings.csvInterval.name(), "100ms").persistent().build(); try { // when server.Start(); string host = "http://localhost:" + server.BaseUri().Port + ServerSettings.rest_api_path.DefaultValue + "/transaction/commit"; for (int i = 0; i < 5; i++) { ClientResponse r = Client.create().resource(host).accept(APPLICATION_JSON).type(APPLICATION_JSON).post(typeof(ClientResponse), "{ 'statements': [ { 'statement': 'CREATE ()' } ] }"); assertEquals(200, r.Status); } // then AssertMetricsExists(metrics, ServerMetrics.THREAD_JETTY_ALL); AssertMetricsExists(metrics, ServerMetrics.THREAD_JETTY_IDLE); } finally { server.Stop(); } }
public FunctionalTestHelper(NeoServer server) { if (server.Database == null) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new Exception("Server must be started before using " + this.GetType().FullName); } this._helper = new GraphDbHelper(server.Database); this._server = server; this._request = new RestRequest(server.BaseUri().resolve("db/data/")); }
private string GetHaEndpoint(NeoServer server) { return(server.BaseUri().ToString() + "db/manage/server/ha"); }