Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failToLockSameFolderAcrossIndependentLockers() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailToLockSameFolderAcrossIndependentLockers()
        {
            StoreLayout storeLayout = TestDirectory.storeLayout();

            using (GlobalStoreLocker storeLocker = new GlobalStoreLocker(FileSystemRule.get(), storeLayout))
            {
                storeLocker.CheckLock();

                try
                {
                    using (GlobalStoreLocker locker = new GlobalStoreLocker(FileSystemRule.get(), storeLayout))
                    {
                        locker.CheckLock();
                        fail("directory should be locked");
                    }
                }
                catch (StoreLockException)
                {
                    // expected
                }

                try
                {
                    using (GlobalStoreLocker locker = new GlobalStoreLocker(FileSystemRule.get(), storeLayout))
                    {
                        locker.CheckLock();
                        fail("directory should be locked");
                    }
                }
                catch (StoreLockException)
                {
                    // expected
                }
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void storeLockFileLocation()
        internal virtual void StoreLockFileLocation()
        {
            StoreLayout storeLayout   = _testDirectory.storeLayout();
            File        storeLockFile = storeLayout.StoreLockFile();

            assertEquals("store_lock", storeLockFile.Name);
            assertEquals(storeLayout.StoreDirectory(), storeLockFile.ParentFile);
        }
Ejemplo n.º 3
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);
            }
        }