示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void nonExistingBackupDirectoryRaisesException() throws org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NonExistingBackupDirectoryRaisesException()
        {
            // given backup directory is not a directory
            _fileSystemAbstraction.deleteRecursively(_backupDirectory.toFile());
            _fileSystemAbstraction.create(_backupDirectory.toFile()).close();

            // then
            Expected.expect(typeof(CommandFailed));
            Expected.expectMessage(stringContainsInOrder(asList("Directory '", "backupDirectory' does not exist.")));

            // when
            Execute();
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.io.File createNeoStoreFile() throws java.io.IOException
        private File CreateNeoStoreFile()
        {
            File neoStoreFile = _testDirectory.databaseLayout().metadataStore();

            _fs.create(neoStoreFile).close();
            return(neoStoreFile);
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private long writeDataThroughFileSystem(java.io.File file, java.nio.channels.ReadableByteChannel data, ByteBuffer temporaryBuffer, boolean hasData) throws java.io.IOException
        private long WriteDataThroughFileSystem(File file, ReadableByteChannel data, ByteBuffer temporaryBuffer, bool hasData)
        {
            using (StoreChannel channel = _fs.create(file))
            {
                return(WriteData(data, temporaryBuffer, hasData, channel));
            }
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void sendEmptyFile() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SendEmptyFile()
        {
            // given
            File emptyFile = TestDirectory.file("emptyFile");

            _fs.create(emptyFile).close();
            FileSender fileSender = new FileSender(new StoreResource(emptyFile, null, 16, _fs));

            // when + then
            assertFalse(fileSender.EndOfInput);
            assertEquals(FileChunk.Create(new sbyte[0], true), fileSender.ReadChunk(_allocator));
            assertNull(fileSender.ReadChunk(_allocator));
            assertTrue(fileSender.EndOfInput);
        }
示例#5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void ensureExists(java.io.File file) throws java.io.IOException
        private void EnsureExists(File file)
        {
            if (!_fsa.fileExists(file))
            {
                _fsa.mkdirs(file.ParentFile);
                using (FlushableChannel channel = new PhysicalFlushableChannel(_fsa.create(file)))
                {
                    _marshal.marshal(_marshal.startState(), channel);
                }
            }
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Before()
        {
            _fs        = Fsr.get();
            _pageCache = PageCacheRule.getPageCache(Fsr.get());
            using (StoreChannel channel = _fs.create(_storeFile))
            {
                ByteBuffer buffer = ByteBuffer.allocate(4);
                buffer.putInt(BLOCK_SIZE);
                buffer.flip();
                channel.write(buffer);
            }
        }
示例#7
0
        /// <summary>
        /// Create/reserve an empty failure file for the given indexId.
        ///
        /// This will overwrite any pre-existing failure file.
        /// </summary>
        /// <exception cref="IOException"> if the failure file could not be created </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public synchronized void reserveForIndex() throws java.io.IOException
        public virtual void ReserveForIndex()
        {
            lock (this)
            {
                _fs.mkdirs(_folderLayout.IndexFolder);
                File failureFile = failureFile();
                using (StoreChannel channel = _fs.create(failureFile))
                {
                    channel.WriteAll(ByteBuffer.wrap(new sbyte[MAX_FAILURE_SIZE]));
                    channel.Force(true);
                }
            }
        }
示例#8
0
 private void EnsureFileExists(File file)
 {
     try
     {
         if (!_fileSystem.fileExists(file))
         {
             _fileSystem.create(file).close();
         }
     }
     catch (IOException e)
     {
         throw new UncheckedIOException("Failed to create file: " + file, e);
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCreatePathThatPointsToFile() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCreatePathThatPointsToFile()
        {
            Fsa.mkdirs(Path);
            assertTrue(Fsa.fileExists(Path));
            Path = new File(Path, "some_file");
            using (StoreChannel channel = Fsa.create(Path))
            {
                assertThat(channel, @is(not(nullValue())));

                Fsa.mkdirs(Path);

                assertTrue(Fsa.fileExists(Path));
            }
        }