Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void serverShouldSupportSsl() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ServerShouldSupportSsl()
        {
            StartServer();

            assertThat(GET(HttpsUri()).status(), @is(200));
            assertThat(GET(_server.baseUri().ToString()).status(), @is(200));
        }
Exemple #2
0
//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));
        }
Exemple #3
0
//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();
        }
Exemple #4
0
//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);
        }
Exemple #5
0
//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);
        }
Exemple #6
0
//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);
        }
Exemple #7
0
//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\">"));
        }
Exemple #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Theory public void shouldRejectIndexValueLargerThanConfiguredSize(String uniqueness)
        public virtual void ShouldRejectIndexValueLargerThanConfiguredSize(string uniqueness)
        {
            //Given
            _server.start();

            // When
            string nodeURI = HTTP.POST(_server.baseUri().ToString() + "db/data/node").header("Location");

            Random r     = new Random();
            string value = "";

            for (int i = 0; i < 6_000; i++)
            {
                value += ( char )(r.Next(26) + 'a');
            }
            HTTP.Response response = HTTP.POST(_server.baseUri().ToString() + "db/data/index/node/favorites?uniqueness=" + uniqueness, quotedJson("{ 'value': '" + value + " ', 'uri':'" + nodeURI + "', 'key': 'some-key' }"));

            // Then
            assertThat(response.Status(), @is(413));
        }
Exemple #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void boltAddressShouldComeFromConnectorAdvertisedAddress() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BoltAddressShouldComeFromConnectorAdvertisedAddress()
        {
            // Given
            string host = "neo4j.com";

            StartServerWithBoltEnabled(host, 9999, "localhost", 0);
            RestRequest request = (new RestRequest(_server.baseUri())).host(host);

            // When
            JaxRsResponse response = request.Get();

            // Then
            IDictionary <string, object> map = JsonHelper.jsonToMap(response.Entity);

            assertThat(map["bolt"].ToString(), containsString("bolt://" + host + ":" + 9999));
        }
Exemple #10
0
//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();
        }
Exemple #11
0
 private string TxURI()
 {
     return(_server.baseUri().ToString() + "db/data/transaction");
 }
Exemple #12
0
 private URI HttpUri()
 {
     return(_server.baseUri());
 }