//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: IndexUpdateStorage(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File file, ByteBufferFactory.Allocator byteBufferFactory, int blockSize, org.neo4j.index.internal.gbptree.Layout<KEY,VALUE> layout) throws java.io.IOException internal IndexUpdateStorage(FileSystemAbstraction fs, File file, ByteBufferFactory.Allocator byteBufferFactory, int blockSize, Layout <KEY, VALUE> layout) : base(fs, file, byteBufferFactory, blockSize) { this._layout = layout; this._key1 = layout.NewKey(); this._key2 = layout.NewKey(); this._value = layout.NewValue(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCloseGlobalAllocationsOnClose() internal virtual void ShouldCloseGlobalAllocationsOnClose() { // given ByteBufferFactory.Allocator allocator = mock(typeof(ByteBufferFactory.Allocator)); when(allocator.Allocate(anyInt())).thenAnswer(invocationOnMock => ByteBuffer.allocate(invocationOnMock.getArgument(0))); ByteBufferFactory factory = new ByteBufferFactory(() => allocator, 100); // when doing some allocations that are counted as global factory.AcquireThreadLocalBuffer(); factory.ReleaseThreadLocalBuffer(); factory.AcquireThreadLocalBuffer(); factory.ReleaseThreadLocalBuffer(); factory.GlobalAllocator().allocate(123); factory.GlobalAllocator().allocate(456); // and closing it factory.Close(); // then InOrder inOrder = inOrder(allocator); inOrder.verify(allocator, times(1)).allocate(100); inOrder.verify(allocator, times(1)).allocate(123); inOrder.verify(allocator, times(1)).allocate(456); inOrder.verify(allocator, times(1)).close(); inOrder.verifyNoMoreInteractions(); }
internal SimpleEntryStorage(FileSystemAbstraction fs, File file, ByteBufferFactory.Allocator byteBufferFactory, int blockSize) { this._fs = fs; this._file = file; this._byteBufferFactory = byteBufferFactory; this._blockSize = blockSize; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCreateNewInstancesOfLocalAllocators() internal virtual void ShouldCreateNewInstancesOfLocalAllocators() { // given System.Func <ByteBufferFactory.Allocator> allocator = mock(typeof(System.Func)); when(allocator()).thenAnswer(invocationOnMock => mock(typeof(ByteBufferFactory.Allocator))); ByteBufferFactory factory = new ByteBufferFactory(allocator, 100); // when ByteBufferFactory.Allocator localAllocator1 = factory.NewLocalAllocator(); ByteBufferFactory.Allocator localAllocator2 = factory.NewLocalAllocator(); localAllocator2.Close(); ByteBufferFactory.Allocator localAllocator3 = factory.NewLocalAllocator(); // then assertNotSame(localAllocator1, localAllocator2); assertNotSame(localAllocator2, localAllocator3); assertNotSame(localAllocator1, localAllocator3); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private IndexKeyStorage<GenericKey> keyStorage(java.io.File file, ByteBufferFactory.Allocator bufferFactory) throws java.io.IOException private IndexKeyStorage <GenericKey> KeyStorage(File file, ByteBufferFactory.Allocator bufferFactory) { return(new IndexKeyStorage <GenericKey>(Directory.FileSystem, file, bufferFactory, BLOCK_SIZE, _layout)); }