Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldRespectTheStoreLock() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldRespectTheStoreLock()
        {
            Path databaseDirectory = _homeDir.resolve("data/databases/foo.db");

            Files.createDirectories(databaseDirectory);
            StoreLayout storeLayout = DatabaseLayout.of(databaseDirectory.toFile()).StoreLayout;

            using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), StoreLocker locker = new StoreLocker(fileSystem, storeLayout))
            {
                locker.CheckLock();
                CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => execute("foo.db", "--force"));
                assertEquals("the database is in use -- stop Neo4j and try again", commandFailed.Message);
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailsOnExistingStoreLockFile() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFailsOnExistingStoreLockFile()
        {
            // Given
            StoreLayout storeLayout = _testDirectory.storeLayout();

            using (FileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction(), StoreLocker @lock = new StoreLocker(fileSystemAbstraction, storeLayout))
            {
                @lock.CheckLock();

                // Then
                _expected.expect(typeof(StoreLockException));
                _expected.expectMessage("Unable to obtain lock on store lock file");
                // When
                BatchInserters.inserter(storeLayout.DatabaseLayout("any").databaseDirectory(), fileSystemAbstraction);
            }
        }