Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotWhitelistDB() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotWhitelistDB()
        {
            // Given
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").build();

            // When
            _server.start();

            // Then I should get a unauthorized response for access to the DB
            HTTP.Response response = HTTP.GET(HTTP.GET(_server.baseUri().resolve("db/data").ToString()).location());
            assertThat(response.Status(), equalTo(401));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotWhitelistConsoleService() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotWhitelistConsoleService()
        {
            // Given
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").build();

            // When
            _server.start();

            // Then I should be able to access the console service
            HTTP.Response response = HTTP.GET(_server.baseUri().resolve("db/manage/server/console").ToString());
            assertThat(response.Status(), equalTo(401));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWhitelistBrowser() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWhitelistBrowser()
        {
            // Given
            assumeTrue(BrowserIsLoaded());
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").build();

            // When
            _server.start();

            // Then I should be able to access the browser
            HTTP.Response response = HTTP.GET(_server.baseUri().resolve("browser/index.html").ToString());
            assertThat(response.Status(), equalTo(200));
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void durationsAlwaysHaveUnitsInJMX() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DurationsAlwaysHaveUnitsInJMX()
        {
            // Given
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(transaction_timeout.name(), "10").build();

            // When
            _server.start();

            // Then
            ObjectName name = getObjectName(_server.Database.Graph, ConfigurationBean.CONFIGURATION_MBEAN_NAME);
            string     attr = getAttribute(name, transaction_timeout.name());

            assertThat(attr, equalTo("10000ms"));
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void serverConfigShouldBeVisibleInJMX() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ServerConfigShouldBeVisibleInJMX()
        {
            // Given
            string configValue = TempDir.newFile().AbsolutePath;

            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(ServerSettings.run_directory.name(), configValue).build();

            // When
            _server.start();

            // Then
            ObjectName name = getObjectName(_server.Database.Graph, ConfigurationBean.CONFIGURATION_MBEAN_NAME);
            string     attr = getAttribute(name, ServerSettings.run_directory.name());

            assertThat(attr, equalTo(configValue));
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowDisablingAuthorization() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowDisablingAuthorization()
        {
            // Given
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), "false").build();

            // When
            _server.start();

            // Then I should have write access
            HTTP.Response response = HTTP.POST(_server.baseUri().resolve("db/data/node").ToString(), quotedJson("{'name':'My Node'}"));
            assertThat(response.Status(), equalTo(201));
            string node = response.Location();

            // Then I should have read access
            assertThat(HTTP.GET(node).status(), equalTo(200));
        }
Ejemplo n.º 7
0
        /*
         * The default jetty behaviour serves an index page for static resources. The 'directories' exposed through this
         * behaviour are not file system directories, but only a list of resources present on the classpath, so there is no
         * security vulnerability. However, it might seem like a vulnerability to somebody without the context of how the
         * whole stack works, so to avoid confusion we disable the jetty behaviour.
         */
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDisallowDirectoryListings() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDisallowDirectoryListings()
        {
            // Given
            _server = CommunityServerBuilder.serverOnRandomPorts().build();
            _server.start();

            // When
            HTTP.Response okResource      = HTTP.GET(_server.baseUri().resolve("/browser/index.html").ToString());
            HTTP.Response illegalResource = HTTP.GET(_server.baseUri().resolve("/browser/assets/").ToString());

            // Then
            // Depends on specific resources exposed by the browser module; if this test starts to fail,
            // check whether the structure of the browser module has changed and adjust accordingly.
            assertEquals(200, okResource.Status());
            assertEquals(403, illegalResource.Status());
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLoadThirdPartyJaxRsClasses() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLoadThirdPartyJaxRsClasses()
        {
            _server = CommunityServerBuilder.serverOnRandomPorts().withThirdPartyJaxRsPackage("org.dummy.web.service", DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();

            URI    thirdPartyServiceUri = (new URI(_server.baseUri().ToString() + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT)).normalize();
            string response             = CLIENT.resource(thirdPartyServiceUri.ToString()).get(typeof(string));

            assertEquals("hello", response);

            // Assert that extensions gets initialized
            int nodesCreated = CreateSimpleDatabase(_server.Database.Graph);

            thirdPartyServiceUri = (new URI(_server.baseUri().ToString() + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT + "/inject-test")).normalize();
            response             = CLIENT.resource(thirdPartyServiceUri.ToString()).get(typeof(string));
            assertEquals(nodesCreated.ToString(), response);
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void allocateServer() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static void AllocateServer()
        {
            _server = CommunityServerBuilder.serverOnRandomPorts().usingDataDir(StaticFolder.Root.AbsolutePath).withAutoIndexingEnabledForNodes("foo", "bar").build();
            _server.start();
            _functionalTestHelper = new FunctionalTestHelper(_server);
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected NeoServer getNeoServer(String customPageSwapperName) throws java.io.IOException
        protected internal override NeoServer GetNeoServer(string customPageSwapperName)
        {
            CommunityServerBuilder builder = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.pagecache_swapper.name(), customPageSwapperName);

            return(builder.Build());
        }