Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void archiveDirectory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ArchiveDirectory()
        {
            File archiveFile = TestDirectory.file("directoryArchive.zip");
            File directory   = TestDirectory.directory("directory");

            FileSystem.create(new File(directory, "a")).close();
            FileSystem.create(new File(directory, "b")).close();
            ZipUtils.Zip(FileSystem, directory, archiveFile);

            assertTrue(FileSystem.fileExists(archiveFile));
            assertEquals(2, CountArchiveEntries(archiveFile));
        }
Exemple #2
0
        /// <summary>
        /// The OverlappingFileLockException is thrown when tryLock is called on the same file *in the same JVM*.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {0, 1}) @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) void creatingSwapperForFileMustTakeLockOnFile(int noChannelStriping) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CreatingSwapperForFileMustTakeLockOnFile(int noChannelStriping)
        {
            PageSwapperFactory factory = CreateSwapperFactory();

            factory.Open(_fileSystem, Configuration.EMPTY);
            File file = TestDir.file("file");

            _fileSystem.create(file).close();

            PageSwapper pageSwapper = CreateSwapper(factory, file, 4, NoCallback, false, Bool(noChannelStriping));

            try
            {
                StoreChannel channel = _fileSystem.open(file, OpenMode.READ_WRITE);
                assertThrows(typeof(OverlappingFileLockException), channel.tryLock);
            }
            finally
            {
                pageSwapper.Close();
            }
        }