public virtual File Build() { File file = new File(_directory, "config"); ServerTestUtils.writeConfigToFile(_config, file); return(file); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public java.io.File createConfigFiles() throws java.io.IOException public virtual File CreateConfigFiles() { File temporaryConfigFile = ServerTestUtils.createTempConfigFile(); File temporaryFolder = ServerTestUtils.createTempDir(); ServerTestUtils.writeConfigToFile(CreateConfiguration(temporaryFolder), temporaryConfigFile); return(temporaryConfigFile); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void periodicCommitTest() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PeriodicCommitTest() { ServerTestUtils.withCSVFile(2, url => { // begin HTTP.Response begin = _http.POST("db/data/cypher", quotedJson("{ 'query': 'USING PERIODIC COMMIT 100 LOAD CSV FROM \\\"" + url + "\\\" AS line CREATE ();' }")); assertThat(begin.status(), equalTo(200)); }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailWhenUsingPeriodicCommitViaNewTxEndpoint() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFailWhenUsingPeriodicCommitViaNewTxEndpoint() { ServerTestUtils.withCSVFile(1, url => { // Given string jsonString = (new PrettyJSON()).array().@object().key("method").value("POST").key("to").value("/transaction/commit").key("body").@object().key("statements").array().@object().key("statement").value("USING PERIODIC COMMIT LOAD CSV FROM '" + url + "' AS line CREATE ()").endObject().endArray().endObject().endObject().endArray().ToString(); // When JsonNode result = JsonHelper.jsonNode(GenConflict.get().expectedStatus(200).payload(jsonString).post(BatchUri()).entity()); // Then JsonNode results = result.get(0).get("body").get("results"); JsonNode errors = result.get(0).get("body").get("errors"); assertTrue("Results not an array", results.Array); assertEquals(0, results.size()); assertTrue("Errors not an array", errors.Array); assertEquals(1, errors.size()); string errorCode = errors.get(0).get("code").TextValue; assertEquals("Neo.ClientError.Statement.SemanticError", errorCode); }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFindThirdPartyJaxRsPackages() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFindThirdPartyJaxRsPackages() { // given File file = ServerTestUtils.createTempConfigFile(Folder.Root); using (StreamWriter @out = new StreamWriter(new StreamWriter(file, true))) { @out.BaseStream.WriteByte(ServerSettings.third_party_packages.name()); @out.Write("="); @out.Write("com.foo.bar=\"mount/point/foo\","); @out.Write("com.foo.baz=\"/bar\","); @out.Write("com.foo.foobarbaz=\"/\""); @out.Write(Environment.NewLine); } // when Config config = Config.fromFile(file).withHome(Folder.Root).build(); // then IList <ThirdPartyJaxRsPackage> thirdpartyJaxRsPackages = config.Get(ServerSettings.third_party_packages); assertNotNull(thirdpartyJaxRsPackages); assertEquals(3, thirdpartyJaxRsPackages.Count); }
public virtual IDictionary <string, string> CreateConfiguration(File temporaryFolder) { IDictionary <string, string> properties = stringMap(ServerSettings.management_api_path.name(), _managementUri, ServerSettings.rest_api_path.name(), _restUri); ServerTestUtils.addDefaultRelativeProperties(properties, temporaryFolder); if (!string.ReferenceEquals(_dataDir, null)) { properties[GraphDatabaseSettings.data_directory.name()] = _dataDir; } if (!string.ReferenceEquals(_maxThreads, null)) { properties[ServerSettings.webserver_max_threads.name()] = _maxThreads; } if (_thirdPartyPackages.Keys.Count > 0) { properties[ServerSettings.third_party_packages.name()] = asOneLine(_thirdPartyPackages); } if (_autoIndexedNodeKeys != null && _autoIndexedNodeKeys.Length > 0) { properties["dbms.auto_index.nodes.enabled"] = "true"; string propertyKeys = org.apache.commons.lang.StringUtils.join(_autoIndexedNodeKeys, ","); properties["dbms.auto_index.nodes.keys"] = propertyKeys; } if (_autoIndexedRelationshipKeys != null && _autoIndexedRelationshipKeys.Length > 0) { properties["dbms.auto_index.relationships.enabled"] = "true"; string propertyKeys = org.apache.commons.lang.StringUtils.join(_autoIndexedRelationshipKeys, ","); properties["dbms.auto_index.relationships.keys"] = propertyKeys; } if (_securityRuleClassNames != null && _securityRuleClassNames.Length > 0) { string propertyKeys = org.apache.commons.lang.StringUtils.join(_securityRuleClassNames, ","); properties[ServerSettings.security_rules.name()] = propertyKeys; } HttpConnector httpConnector = new HttpConnector("http", HttpConnector.Encryption.NONE); HttpConnector httpsConnector = new HttpConnector("https", HttpConnector.Encryption.TLS); properties[httpConnector.Type.name()] = "HTTP"; properties[httpConnector.Enabled.name()] = _httpEnabled.ToString(); properties[httpConnector.Address.name()] = _address.ToString(); properties[httpConnector.Encryption.name()] = "NONE"; properties[httpsConnector.Type.name()] = "HTTP"; properties[httpsConnector.Enabled.name()] = _httpsEnabled.ToString(); properties[httpsConnector.Address.name()] = _httpsAddress.ToString(); properties[httpsConnector.Encryption.name()] = "TLS"; properties[GraphDatabaseSettings.auth_enabled.name()] = "false"; properties[LegacySslPolicyConfig.certificates_directory.name()] = (new File(temporaryFolder, "certificates")).AbsolutePath; properties[GraphDatabaseSettings.logs_directory.name()] = (new File(temporaryFolder, "logs")).AbsolutePath; properties[GraphDatabaseSettings.logical_logs_location.name()] = (new File(temporaryFolder, "transaction-logs")).AbsolutePath; properties[GraphDatabaseSettings.pagecache_memory.name()] = "8m"; properties[GraphDatabaseSettings.shutdown_transaction_end_timeout.name()] = "0s"; foreach (object key in _arbitraryProperties.Keys) { properties[key.ToString()] = _arbitraryProperties.get(key).ToString(); } return(properties); }
private TestServerBuilder GetServerBuilder(File targetFolder) { TestServerBuilder serverBuilder = newInProcessBuilder(targetFolder).withConfig(LegacySslPolicyConfig.certificates_directory.name(), ServerTestUtils.getRelativePath(TestDir.directory(), LegacySslPolicyConfig.certificates_directory)); return(serverBuilder); }