private static void InitBuilder() { if (_builder == null) { _builder = CommunityServerBuilder.server(); } }
//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)); }
//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)); }
internal static void SetServerBuilderProperty(string key, string value) { lock (typeof(ServerHolder)) { InitBuilder(); _builder = _builder.withProperty(key, value); } }
//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(); }
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 + "\"")); }
//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); }); }
//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); }
//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); }
//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()); }
//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()); }
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); }
//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)); }
private static void Shutdown() { lock (typeof(ServerHolder)) { _allocation = null; try { if (_server != null) { _server.stop(); } } finally { _builder = null; _server = null; } } }
//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(); }