//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) void shouldReportAHelpfulErrorIfWeDontHaveWritePermissionsForLock() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldReportAHelpfulErrorIfWeDontHaveWritePermissionsForLock() { StoreLayout storeLayout = DatabaseLayout.of(_databaseDirectory.toFile()).StoreLayout; using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), StoreLocker storeLocker = new StoreLocker(fileSystem, storeLayout)) { storeLocker.CheckLock(); using (System.IDisposable ignored = withPermissions(storeLayout.StoreLockFile().toPath(), emptySet())) { CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => execute("foo.db")); assertEquals(commandFailed.Message, "you do not have permission to dump the database -- is Neo4j running as a different user?"); } } }
public StoreLocker(FileSystemAbstraction fileSystemAbstraction, StoreLayout storeLayout) { this.FileSystemAbstraction = fileSystemAbstraction; StoreLockFile = storeLayout.StoreLockFile(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotObtainLockWhenUnableToOpenLockFile() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotObtainLockWhenUnableToOpenLockFile() { FileSystemAbstraction fileSystemAbstraction = new DelegatingFileSystemAbstractionAnonymousInnerClass4(this, FileSystemRule.get()); StoreLayout storeLayout = Target.storeLayout(); try { using (StoreLocker storeLocker = new StoreLocker(fileSystemAbstraction, storeLayout)) { storeLocker.CheckLock(); fail(); } } catch (StoreLockException e) { string msg = format("Unable to obtain lock on store lock file: %s. " + "Please ensure no other process is using this database, and that the " + "directory is writable (required even for read-only access)", storeLayout.StoreLockFile()); assertThat(e.Message, @is(msg)); } }