//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void moveAwayDb(java.io.File databaseDirectory, java.io.File branchedDataDir) throws java.io.IOException public static void MoveAwayDb(File databaseDirectory, File branchedDataDir) { foreach (File file in RelevantDbFiles(databaseDirectory)) { FileUtils.moveFileToDirectory(file, branchedDataDir); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void cleanStoreDir(java.io.File databaseDirectory) throws java.io.IOException public static void CleanStoreDir(File databaseDirectory) { foreach (File file in RelevantDbFiles(databaseDirectory)) { FileUtils.deleteRecursively(file); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBehaveCorrectlyUnderStress() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBehaveCorrectlyUnderStress() { int durationInMinutes = parseInt(fromEnv("TX_APPENDER_STRESS_DURATION", DEFAULT_DURATION_IN_MINUTES)); File workingDirectory = new File(fromEnv("TX_APPENDER_WORKING_DIRECTORY", _defaultWorkingDir)); int threads = parseInt(fromEnv("TX_APPENDER_NUM_THREADS", DEFAULT_NUM_THREADS)); Callable <long> runner = (new Builder()).with(untilTimeExpired(durationInMinutes, MINUTES)).withWorkingDirectory(DatabaseLayout.of(ensureExistsAndEmpty(workingDirectory))).withNumThreads(threads).build(); long appendedTxs = runner.call(); assertEquals((new TransactionIdChecker(workingDirectory)).parseAllTxLogs(), appendedTxs); // let's cleanup disk space when everything went well FileUtils.deleteRecursively(workingDirectory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailToValidateConstraintsIfUnderlyingIndexIsFailed() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFailToValidateConstraintsIfUnderlyingIndexIsFailed() { // given a perfectly normal constraint File dir = Directory.databaseDir(); GraphDatabaseService db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(dir); try { using (Transaction tx = Db.beginTx()) { Db.schema().constraintFor(label("Label1")).assertPropertyIsUnique("key1").create(); tx.Success(); } } finally { Db.shutdown(); } // Remove the indexes offline and start up with an index provider which reports FAILED as initial state. An ordeal, I know right... FileUtils.deleteRecursively(IndexDirectoryStructure.baseSchemaIndexFolder(dir)); db = (new TestGraphDatabaseFactory()).removeKernelExtensions(INDEX_PROVIDERS_FILTER).addKernelExtension(new FailingGenericNativeIndexProviderFactory(INITIAL_STATE)).newEmbeddedDatabase(dir); // when try { using (Transaction tx = Db.beginTx()) { Db.createNode(label("Label1")).setProperty("key1", "value1"); fail("expected exception"); } } // then catch (ConstraintViolationException e) { assertThat(e.InnerException, instanceOf(typeof(UnableToValidateConstraintException))); assertThat(e.InnerException.InnerException.Message, allOf(containsString("The index is in a failed state:"), containsString(INITIAL_STATE_FAILURE_MESSAGE))); } finally { Db.shutdown(); } }
/// <summary> /// For backwards-compatibility reasons, we support both PEM-encoded private keys *and* raw binary files containing /// the private key data /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldLoadBinaryPrivateKey() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldLoadBinaryPrivateKey() { // Given SelfSignedCertificate cert = new SelfSignedCertificate("example.com"); PkiUtils certs = new PkiUtils(); File keyFile = _testDirectory.file("certificate"); assertTrue(keyFile.createNewFile()); sbyte[] raw = certs.LoadPrivateKey(cert.privateKey()).Encoded; using (FileChannel ch = FileChannel.open(keyFile.toPath(), WRITE)) { FileUtils.writeAll(ch, ByteBuffer.wrap(raw)); } // When PrivateKey pk = certs.LoadPrivateKey(keyFile); // Then assertNotNull(pk); }
/// <summary> /// For backwards-compatibility reasons, we support both PEM-encoded certificates *and* raw binary files containing /// the certificate data. /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldLoadBinaryCertificates() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldLoadBinaryCertificates() { // Given SelfSignedCertificate cert = new SelfSignedCertificate("example.com"); PkiUtils certs = new PkiUtils(); File cPath = _testDirectory.file("certificate"); assertTrue(cPath.createNewFile()); sbyte[] raw = certs.LoadCertificates(cert.certificate())[0].Encoded; using (FileChannel ch = FileChannel.open(cPath.toPath(), WRITE)) { FileUtils.writeAll(ch, ByteBuffer.wrap(raw)); } // When Certificate[] certificates = certs.LoadCertificates(cPath); // Then assertThat(certificates.Length, equalTo(1)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void deleteRecursive(java.io.File databaseDirectory) throws java.io.IOException public static void DeleteRecursive(File databaseDirectory) { FileUtils.deleteRecursively(databaseDirectory); }