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 testOffsetFileChannel() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestOffsetFileChannel()
        {
            using (JumpingFileSystemAbstraction offsetFileSystem = new JumpingFileSystemAbstraction(10))
            {
                File fileName = new File("target/var/neostore.nodestore.db");
                offsetFileSystem.DeleteFile(fileName);
                offsetFileSystem.Mkdirs(fileName.ParentFile);
                IdGenerator idGenerator = (new JumpingIdGeneratorFactory(10)).Get(IdType.NODE);

                using (JumpingFileChannel channel = ( JumpingFileChannel )offsetFileSystem.Open(fileName, OpenMode.READ_WRITE))
                {
                    for (int i = 0; i < 16; i++)
                    {
                        WriteSomethingLikeNodeRecord(channel, idGenerator.NextId(), i);
                    }
                }
                using (JumpingFileChannel channel = ( JumpingFileChannel )offsetFileSystem.Open(fileName, OpenMode.READ_WRITE))
                {
                    idGenerator = (new JumpingIdGeneratorFactory(10)).Get(IdType.NODE);

                    for (int i = 0; i < 16; i++)
                    {
                        assertEquals(i, ReadSomethingLikeNodeRecord(channel, idGenerator.NextId()));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal JumpingFileChannel(JumpingFileSystemAbstraction outerInstance, StoreFileChannel actual, int recordSize) : base(actual)
 {
     this._outerInstance = outerInstance;
     this.RecordSize     = recordSize;
 }