//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void mustDisableStripingIfToldTo() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void MustDisableStripingIfToldTo() { // given int bytesPerPage = 32; PageSwapperFactory factory = CreateSwapperFactory(); FileSystemAbstraction fs = mock(typeof(FileSystemAbstraction)); StoreChannel channel = mock(typeof(StoreChannel)); when(channel.TryLock()).thenReturn(mock(typeof(FileLock))); when(fs.Create(any(typeof(File)))).thenReturn(channel); when(fs.Open(any(typeof(File)), any())).thenReturn(channel); // when factory.Open(fs, Configuration.EMPTY); PageSwapper swapper = CreateSwapper(factory, _file, bytesPerPage, NoCallback, true, true); try { // then verify(fs, times(1)).open(eq(_file), any(typeof(OpenMode))); } finally { swapper.Close(); } }
//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 mustCloseFilesIfTakingFileLockThrows(int noChannelStriping) throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void MustCloseFilesIfTakingFileLockThrows(int noChannelStriping) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicInteger openFilesCounter = new java.util.concurrent.atomic.AtomicInteger(); AtomicInteger openFilesCounter = new AtomicInteger(); PageSwapperFactory factory = CreateSwapperFactory(); factory.open(new DelegatingFileSystemAbstractionAnonymousInnerClass(this, _fileSystem, openFilesCounter) , Configuration.EMPTY); File file = TestDir.file("file"); try { using (StoreChannel ch = _fileSystem.create(file), FileLock ignore = ch.TryLock()) { CreateSwapper(factory, file, 4, NoCallback, false, Bool(noChannelStriping)).close(); fail("Creating a page swapper for a locked channel should have thrown"); } } catch (FileLockException) { // As expected. } assertThat(openFilesCounter.get(), @is(0)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public java.nio.channels.FileLock tryLock() throws java.io.IOException public override FileLock TryLock() { return(@delegate.TryLock()); }