//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldGiveAClearErrorMessageIfTheDestinationsParentDirectoryDoesntExist() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldGiveAClearErrorMessageIfTheDestinationsParentDirectoryDoesntExist() { Path archive = _testDirectory.file("the-archive.dump").toPath(); Path destination = Paths.get(_testDirectory.absolutePath().AbsolutePath, "subdir", "the-destination"); NoSuchFileException noSuchFileException = assertThrows(typeof(NoSuchFileException), () => (new Loader()).load(archive, destination, destination)); assertEquals(destination.Parent.ToString(), noSuchFileException.Message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRecoverCreationOfUniquenessConstraintFollowedByDeletionOfThatSameConstraint() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRecoverCreationOfUniquenessConstraintFollowedByDeletionOfThatSameConstraint() { // given CreateUniqueConstraint(); DropConstraints(); // when - perform recovery Restart(Snapshot(StoreDir.absolutePath())); // then - just make sure the constraint is gone using (Transaction tx = _db.beginTx()) { assertFalse(_db.schema().getConstraints(_label).GetEnumerator().hasNext()); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void makeSureBackupCanBePerformedWithCustomPort() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MakeSureBackupCanBePerformedWithCustomPort() { assumeFalse(SystemUtils.IS_OS_WINDOWS); string backupName = "customport" + RecordFormat; // due to ClassRule not cleaning between tests int backupPort = PortAuthority.allocatePort(); StartDb(backupPort); assertEquals("should not be able to do backup when noone is listening", 1, RunBackupTool(_testDirectory.absolutePath(), "--from", "127.0.0.1:" + PortAuthority.allocatePort(), "--cc-report-dir=" + _backupDir, "--backup-dir=" + _backupDir, "--name=" + backupName)); assertEquals(0, RunBackupTool(_testDirectory.absolutePath(), "--from", "127.0.0.1:" + backupPort, "--cc-report-dir=" + _backupDir, "--backup-dir=" + _backupDir, "--name=" + backupName)); assertEquals(DbRepresentation.of(_db), GetBackupDbRepresentation(backupName)); CreateSomeData(_db); assertEquals(0, RunBackupTool(_testDirectory.absolutePath(), "--from", "127.0.0.1:" + backupPort, "--cc-report-dir=" + _backupDir, "--backup-dir=" + _backupDir, "--name=" + backupName)); assertEquals(DbRepresentation.of(_db), GetBackupDbRepresentation(backupName)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToAttachToPidAndRunThreadDump() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToAttachToPidAndRunThreadDump() { long pid = PID; assertThat(pid, @is(not(0))); // Write config file Files.createFile(TestDirectory.file("neo4j.conf").toPath()); // write neo4j.pid file File run = TestDirectory.directory("run"); Files.write(Paths.get(run.AbsolutePath, "neo4j.pid"), pid.ToString().GetBytes()); // Run command, should detect running instance try { using (RealOutsideWorld outsideWorld = new RealOutsideWorld()) { string[] args = new string[] { "threads", "--to=" + TestDirectory.absolutePath().AbsolutePath + "/reports" }; Path homeDir = TestDirectory.directory().toPath(); DiagnosticsReportCommand diagnosticsReportCommand = new DiagnosticsReportCommand(homeDir, homeDir, outsideWorld); diagnosticsReportCommand.Execute(args); } } catch (IncorrectUsage e) { if (e.Message.Equals("Unknown classifier: threads")) { return; // If we get attach API is not available for example in some IBM jdk installs, ignore this test } throw e; } // Verify that we took a thread dump File reports = TestDirectory.directory("reports"); File[] files = reports.listFiles(); assertThat(files, notNullValue()); assertThat(Files.Length, @is(1)); Path report = files[0].toPath(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.net.URI uri = java.net.URI.create("jar:file:" + report.toUri().getRawPath()); URI uri = URI.create("jar:file:" + report.toUri().RawPath); using (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) { string threadDump = new string( Files.readAllBytes(fs.getPath("threaddump.txt"))); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method: assertThat(threadDump, containsString(typeof(DiagnosticsReportCommandIT).FullName)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeEach void setUp() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void SetUp() { _homeDir = _testDirectory.directory("home-dir").toPath(); _configDir = _testDirectory.directory("config-dir").toPath(); // Touch config _configFile = _configDir.resolve("neo4j.conf"); Files.createFile(_configFile); // To make sure files are resolved from the working directory _originalUserDir = System.setProperty("user.dir", _testDirectory.absolutePath().AbsolutePath); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHaveRelativeMetricsCsvPathBeRelativeToNeo4jHome() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHaveRelativeMetricsCsvPathBeRelativeToNeo4jHome() { // GIVEN File home = _directory.absolutePath(); Config config = config(MetricsSettings.csvEnabled.name(), "true", MetricsSettings.csvInterval.name(), "10ms", MetricsSettings.csvPath.name(), "the-metrics-dir", GraphDatabaseSettings.neo4j_home.name(), home.AbsolutePath); _life.add(CreateCsvOutput(config)); // WHEN _life.start(); // THEN WaitForFileToAppear(new File(home, "the-metrics-dir")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void schemaTransactionsShouldSurviveRecovery() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SchemaTransactionsShouldSurviveRecovery() { // given File storeDir = TestDirectory.absolutePath(); Process process = (new CreateConstraintButDoNotShutDown()).Start(storeDir); process.WaitForSchemaTransactionCommitted(); SubProcess.kill(process); // when GraphDatabaseService recoveredDatabase = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(storeDir); // then assertEquals(1, Constraints(recoveredDatabase).Count); assertEquals(1, Indexes(recoveredDatabase).Count); recoveredDatabase.Shutdown(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private int runBackupToolFromOtherJvmToGetExitCode(String... args) throws Exception private int RunBackupToolFromOtherJvmToGetExitCode(params string[] args) { return(TestHelpers.runBackupToolFromOtherJvmToGetExitCode(_testDirectory.absolutePath(), args)); }
private File StoreDir() { return(Directory.absolutePath()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void forceShouldRespectStoreLock() public virtual void ForceShouldRespectStoreLock() { string databaseName = "to"; Config config = ConfigWith(databaseName, Directory.absolutePath().AbsolutePath); File fromPath = new File(Directory.absolutePath(), "from"); File toPath = config.Get(GraphDatabaseSettings.database_path); int fromNodeCount = 10; int toNodeCount = 20; CreateDbAt(fromPath, fromNodeCount); CreateDbAt(toPath, toNodeCount); FileSystemAbstraction fs = FileSystemRule.get(); try { using (StoreLocker storeLocker = new StoreLocker(fs, DatabaseLayout.of(toPath).StoreLayout)) { storeLocker.CheckLock(); (new RestoreDatabaseCommand(fs, fromPath, config, databaseName, true)).Execute(); fail("expected exception"); } } catch (Exception e) { assertThat(e.Message, equalTo("the database is in use -- stop Neo4j and try again")); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void start() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Start() { _jobScheduler = new ThreadPoolJobScheduler(); _stores = BatchingNeoStores.batchingNeoStores(_fileSystemRule.get(), _directory.absolutePath(), Format, _config, NullLogService.Instance, AdditionalInitialIds.EMPTY, Config.defaults(), _jobScheduler); _stores.createNew(); }