コード例 #1
0
 private static void InitBuilder()
 {
     if (_builder == null)
     {
         _builder = CommunityServerBuilder.server();
     }
 }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shellConsoleShouldBeEnabledByDefault() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShellConsoleShouldBeEnabledByDefault()
            {
                Server = CommunityServerBuilder.server().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
                Server.start();

                assertThat(Exec("ls", "shell").Status, @is(200));
            }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToExplicitlySetConsolesToEnabled() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShouldBeAbleToExplicitlySetConsolesToEnabled()
            {
                Server = CommunityServerBuilder.server().withProperty(ServerSettings.console_module_engines.name(), "").usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
                Server.start();

                assertThat(Exec("ls", "shell").Status, @is(400));
            }
コード例 #4
0
 internal static void SetServerBuilderProperty(string key, string value)
 {
     lock (typeof(ServerHolder))
     {
         InitBuilder();
         _builder = _builder.withProperty(key, value);
     }
 }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRespondWith201IfAllTheRulesPassWhenCreatingANode() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRespondWith201IfAllTheRulesPassWhenCreatingANode()
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            _server = CommunityServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().withSecurityRules(typeof(PermanentlyPassingSecurityRule).FullName).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();
            _functionalTestHelper = new FunctionalTestHelper(_server);

            Gen.get().expectedStatus(201).expectedHeader("Location").post(_functionalTestHelper.nodeUri()).response();
        }
コード例 #6
0
        public virtual void Should401WithBasicChallengeWhenASecurityRuleFails()
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            _server = CommunityServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().withSecurityRules(typeof(PermanentlyFailingSecurityRule).FullName).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();
            _functionalTestHelper = new FunctionalTestHelper(_server);
            JaxRsResponse response = Gen.get().expectedStatus(401).expectedHeader("WWW-Authenticate").post(_functionalTestHelper.nodeUri()).response();

            assertThat(response.Headers.getFirst("WWW-Authenticate"), containsString("Basic realm=\"" + PermanentlyFailingSecurityRule.REALM + "\""));
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void initServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static void InitServer()
        {
            suppressAll().call((Callable <Void>)() =>
            {
                CommunityServerBuilder serverBuilder = EnterpriseServerBuilder.serverOnRandomPorts();

                PropertyExistenceConstraintsIT._server = ServerHelper.createNonPersistentServer(serverBuilder);
                return(null);
            });
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void should403WhenAuthenticatedButForbidden() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Should403WhenAuthenticatedButForbidden()
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            _server = CommunityServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().withSecurityRules(typeof(PermanentlyForbiddenSecurityRule).FullName, typeof(PermanentlyPassingSecurityRule).FullName).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();
            _functionalTestHelper = new FunctionalTestHelper(_server);

            JaxRsResponse clientResponse = Gen.get().expectedStatus(403).expectedType(MediaType.APPLICATION_JSON_TYPE).get(TrimTrailingSlash(_functionalTestHelper.baseUri())).response();

            assertEquals(403, clientResponse.Status);
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void setupServer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public static void SetupServer()
            {
                Server = CommunityServerBuilder.server().usingDataDir(StaticFolder.Root.AbsolutePath).build();

                suppressAll().call((Callable <Void>)() =>
                {
                    Server.start();
                    return(null);
                });
                FunctionalTestHelper = new FunctionalTestHelper(Server);
            }
コード例 #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private CommunityNeoServer buildServer(String hstsValue) throws Exception
        private CommunityNeoServer BuildServer(string hstsValue)
        {
            CommunityServerBuilder builder = serverOnRandomPorts().withHttpsEnabled().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath);

            if (!string.ReferenceEquals(hstsValue, null))
            {
                builder.WithProperty(ServerSettings.http_strict_transport_security.name(), hstsValue);
            }

            return(builder.Build());
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeAllSecurityRules() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeAllSecurityRules()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            _server = CommunityServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().withSecurityRules(typeof(NoAccessToDatabaseSecurityRule).FullName).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();
            _functionalTestHelper = new FunctionalTestHelper(_server);

            // when
            Gen.get().expectedStatus(401).get(_functionalTestHelper.dataUri()).response();

            // then
            assertTrue(NoAccessToDatabaseSecurityRule.WasInvoked());
        }
コード例 #12
0
        public virtual void ASimpleWildcardUriPathShould401OnAccessToProtectedSubPath()
        {
            string mountPoint = "/protected/tree/starts/here" + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT;

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            _server = CommunityServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().withThirdPartyJaxRsPackage("org.dummy.web.service", mountPoint).withSecurityRules(typeof(PermanentlyFailingSecurityRuleWithWildcardPath).FullName).usingDataDir(Folder.directory(Name.MethodName).AbsolutePath).build();
            _server.start();

            _functionalTestHelper = new FunctionalTestHelper(_server);

            JaxRsResponse clientResponse = Gen.get().expectedStatus(401).expectedType(MediaType.APPLICATION_JSON_TYPE).expectedHeader("WWW-Authenticate").get(TrimTrailingSlash(_functionalTestHelper.baseUri()) + mountPoint + "/more/stuff").response();

            assertEquals(401, clientResponse.Status);
        }
コード例 #13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: AbstractRESTInteraction(java.util.Map<String,String> config) throws java.io.IOException
        internal AbstractRESTInteraction(IDictionary <string, string> config)
        {
            CommunityServerBuilder builder = EnterpriseServerBuilder.serverOnRandomPorts();

            builder = builder.WithProperty((new BoltConnector("bolt")).type.name(), "BOLT").withProperty((new BoltConnector("bolt")).enabled.name(), "true").withProperty((new BoltConnector("bolt")).encryption_level.name(), OPTIONAL.name()).withProperty(LegacySslPolicyConfig.tls_key_file.name(), NeoInteractionLevel.tempPath("key", ".key")).withProperty(LegacySslPolicyConfig.tls_certificate_file.name(), NeoInteractionLevel.tempPath("cert", ".cert")).withProperty(GraphDatabaseSettings.auth_enabled.name(), Convert.ToString(true));

            foreach (KeyValuePair <string, string> entry in config.SetOfKeyValuePairs())
            {
                builder = builder.WithProperty(entry.Key, entry.Value);
            }
            this.Server = builder.Build();
            this.Server.start();
            _authManager           = this.Server.DependencyResolver.resolveDependency(typeof(EnterpriseAuthManager));
            _connectorPortRegister = Server.DependencyResolver.resolveDependency(typeof(ConnectorPortRegister));
        }
コード例 #14
0
 private static void Shutdown()
 {
     lock (typeof(ServerHolder))
     {
         _allocation = null;
         try
         {
             if (_server != null)
             {
                 _server.stop();
             }
         }
         finally
         {
             _builder = null;
             _server  = null;
         }
     }
 }
コード例 #15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void startServer(boolean authEnabled) throws java.io.IOException
        public virtual void StartServer(bool authEnabled)
        {
            _server = CommunityServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.auth_enabled.name(), Convert.ToString(authEnabled)).build();
            _server.start();
        }