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 shouldNotHaveTxLogsIfDirectoryHasFilesWithIncorrectName() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotHaveTxLogsIfDirectoryHasFilesWithIncorrectName()
        {
            File txDir = _config.get(GraphDatabaseSettings.logical_logs_location);

            _fsa.mkdir(txDir);

            _fsa.create(new File(txDir, "foo.bar")).close();

            assertFalse(_commitStateHelper.hasTxLogs(_databaseLayout));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void storeFileContent(java.io.File file, ByteBuffer sourceBuffer) throws java.io.IOException
        private void StoreFileContent(File file, ByteBuffer sourceBuffer)
        {
            using (StoreChannel storeChannel = _fileSystem.create(file))
            {
                storeChannel.WriteAll(sourceBuffer);
            }
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldErrorIfRealUsersAlreadyExistCommunity() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldErrorIfRealUsersAlreadyExistCommunity()
        {
            // Given
            File authFile = GetAuthFile("auth");

            _fileSystem.mkdirs(authFile.ParentFile);
            _fileSystem.create(authFile);

            // When
            _tool.execute(_homeDir.toPath(), _confDir.toPath(), SET_PASSWORD, "will-be-ignored");

            // Then
            AssertNoAuthIniFile();
            verify(@out, times(1)).stdErrLine("command failed: the provided initial password was not set because existing Neo4j users were " + "detected at `" + authFile.AbsolutePath + "`. Please remove the existing `auth` file if you " + "want to reset your database to only have a default user with the provided password.");
            verify(@out).exit(1);
            verify(@out, times(0)).stdOutLine(anyString());
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.nio.file.Path createFakeDbDir(java.nio.file.Path homeDir) throws java.io.IOException
        private Path CreateFakeDbDir(Path homeDir)
        {
            Path graphDb = homeDir.resolve("data/databases/graph.db");

            _fs.mkdirs(graphDb.toFile());
            _fs.create(graphDb.resolve("neostore").toFile()).close();
            return(graphDb);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createFileOfSize(java.io.File file, int size) throws java.io.IOException
        private void CreateFileOfSize(File file, int size)
        {
            using (StoreChannel storeChannel = _fs.create(file))
            {
                sbyte[]    bytes  = new sbyte[size];
                ByteBuffer buffer = ByteBuffer.wrap(bytes);
                storeChannel.WriteAll(buffer);
            }
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeState(T state) throws java.io.IOException
        public override void WriteState(T state)
        {
            _fileSystem.mkdirs(_file.ParentFile);
            _fileSystem.deleteFile(_file);

            using (FlushableChannel channel = new PhysicalFlushableChannel(_fileSystem.create(_file)))
            {
                _marshal.marshal(state, channel);
            }
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void allocateResources() throws java.io.IOException
        private void AllocateResources()
        {
            if (!_allocated)
            {
                this._buffer       = _byteBufferFactory.allocate(_blockSize);
                this._pageCursor   = new ByteArrayPageCursor(_buffer);
                this._storeChannel = _fs.create(_file);
                this._allocated    = true;
            }
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOverwriteInitialPasswordFileIfExists() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOverwriteInitialPasswordFileIfExists()
        {
            // Given
            _fileSystem.mkdirs(_authInitFile.ParentFile);
            _fileSystem.create(_authInitFile);

            // When
            string[] arguments = new string[] { "123" };
            _setPasswordCommand.execute(arguments);

            // Then
            AssertAuthIniFile("123");
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMigrateClusterStateFromStoreDir() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMigrateClusterStateFromStoreDir()
        {
            // given
            File storeDir = new File(new File(_dataDir, "databases"), GraphDatabaseSettings.DEFAULT_DATABASE_NAME);

            string fileName = "file";

            File oldStateDir         = new File(storeDir, ClusterStateDirectory.CLUSTER_STATE_DIRECTORY_NAME);
            File oldClusterStateFile = new File(oldStateDir, fileName);

            _fs.mkdirs(oldStateDir);
            _fs.create(oldClusterStateFile).close();

            // when
            ClusterStateDirectory clusterStateDirectory = new ClusterStateDirectory(_dataDir, storeDir, false);

            clusterStateDirectory.Initialize(_fs);

            // then
            assertEquals(clusterStateDirectory.Get(), _stateDir);
            assertTrue(_fs.fileExists(new File(clusterStateDirectory.Get(), fileName)));
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PageSwapper createPageSwapper(java.io.File file, int filePageSize, org.neo4j.io.pagecache.PageEvictionCallback onEviction, boolean createIfNotExist, boolean noChannelStriping) throws java.io.IOException
        public override PageSwapper CreatePageSwapper(File file, int filePageSize, PageEvictionCallback onEviction, bool createIfNotExist, bool noChannelStriping)
        {
            if (!_fs.fileExists(file))
            {
                if (createIfNotExist)
                {
                    _fs.create(file).close();
                }
                else
                {
                    throw new NoSuchFileException(file.Path, null, "Cannot map non-existing file");
                }
            }
            return(new SingleFilePageSwapper(file, _fs, filePageSize, onEviction, noChannelStriping));
        }