//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 WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: BlockStorage(org.neo4j.index.internal.gbptree.Layout<KEY,VALUE> layout, ByteBufferFactory bufferFactory, org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File blockFile, Monitor monitor) throws java.io.IOException internal BlockStorage(Layout <KEY, VALUE> layout, ByteBufferFactory bufferFactory, FileSystemAbstraction fs, File blockFile, Monitor monitor) { this._layout = layout; this._fs = fs; this._blockFile = blockFile; this._monitor = monitor; this._blockSize = bufferFactory.BufferSize(); this._bufferedEntries = Lists.mutable.empty(); this._bufferFactory = bufferFactory; this._comparator = (e0, e1) => layout.Compare(e0.key(), e1.key()); this._storeChannel = fs.Create(blockFile); ResetBufferedEntries(); }
private static void WriteContents(FileSystemAbstraction fileSystemAbstraction, File file, string contents) { sbyte[] bytes = contents.GetBytes(); try { using (StoreChannel storeChannel = fileSystemAbstraction.Create(file)) { storeChannel.write(ByteBuffer.wrap(bytes)); } } catch (IOException e) { throw new Exception(e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static void saveFulltextIndexSettings(FulltextIndexDescriptor descriptor, java.io.File indexFolder, org.neo4j.io.fs.FileSystemAbstraction fs) throws java.io.IOException internal static void SaveFulltextIndexSettings(FulltextIndexDescriptor descriptor, File indexFolder, FileSystemAbstraction fs) { File indexConfigFile = new File(indexFolder, INDEX_CONFIG_FILE); Properties settings = new Properties(); settings.setProperty(INDEX_CONFIG_EVENTUALLY_CONSISTENT, Convert.ToString(descriptor.EventuallyConsistent)); settings.setProperty(INDEX_CONFIG_ANALYZER, descriptor.AnalyzerName()); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: settings.setProperty(INDEX_CONFIG_PROPERTY_NAMES, descriptor.PropertyNames().collect(Collectors.joining(", ", "[", "]"))); settings.setProperty("_propertyIds", Arrays.ToString(descriptor.Properties())); settings.setProperty("_name", descriptor.Name()); settings.setProperty("_schema_entityType", descriptor.Schema().entityType().name()); settings.setProperty("_schema_entityTokenIds", Arrays.ToString(descriptor.Schema().EntityTokenIds)); using (StoreChannel channel = fs.Create(indexConfigFile), Writer writer = fs.OpenAsWriter(indexConfigFile, StandardCharsets.UTF_8, false)) { settings.store(writer, "Auto-generated file. Do not modify!"); writer.flush(); channel.Force(true); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.io.File badDataFile(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File badDataPath) throws java.io.IOException private File BadDataFile(FileSystemAbstraction fileSystem, File badDataPath) { fileSystem.Mkdir(badDataPath.ParentFile); fileSystem.Create(badDataPath); return(badDataPath); }