コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void returnSumOfRaftLogDirectory() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReturnSumOfRaftLogDirectory()
        {
            File raftLogDirectory = new File(_clusterStateDirectory.get(), RAFT_LOG_DIRECTORY_NAME);

            _fs.mkdirs(raftLogDirectory);

            CreateFileOfSize(new File(raftLogDirectory, "raftLog1"), 5);
            CreateFileOfSize(new File(raftLogDirectory, "raftLog2"), 10);

            assertEquals(15L, _ccBean.RaftLogSize);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.io.File getArchiveFile(long recoveredTransactionLogVersion, long recoveredTransactionOffset) throws java.io.IOException
        private File GetArchiveFile(long recoveredTransactionLogVersion, long recoveredTransactionOffset)
        {
            File corruptedLogsFolder = new File(_storeDir, CorruptedTxLogsBaseName);

            _fs.mkdirs(corruptedLogsFolder);
            return(new File(corruptedLogsFolder, format(_logFileArchivePattern, recoveredTransactionLogVersion, recoveredTransactionOffset, DateTimeHelper.CurrentUnixTimeMillis())));
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public StoreFileStream acquire(String destination, int requiredAlignment) throws java.io.IOException
        public override StoreFileStream Acquire(string destination, int requiredAlignment)
        {
            File fileName = new File(_storeDir, destination);

            _fs.mkdirs(fileName.ParentFile);
            _fileCopyMonitor.copyFile(fileName);
            return(StreamToDisk.FromFile(_fs, fileName));
        }
コード例 #4
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());
        }
コード例 #5
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);
        }
コード例 #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);
            }
        }
コード例 #7
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");
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            _databaseLayout       = _testDirectory.databaseLayout();
            _storeDir             = _databaseLayout.databaseDirectory();
            _nativeLabelIndex     = _databaseLayout.labelScanStore();
            _migrationLayout      = _testDirectory.databaseLayout("migrationDir");
            _luceneLabelScanStore = _testDirectory.databaseDir().toPath().resolve(Paths.get("schema", "label", "lucene")).toFile();

            _fileSystem    = _fileSystemRule.get();
            _pageCache     = _pageCacheRule.getPageCache(_fileSystemRule);
            _indexMigrator = new NativeLabelScanStoreMigrator(_fileSystem, _pageCache, Config.defaults());
            _fileSystem.mkdirs(_luceneLabelScanStore);
        }
コード例 #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)));
        }
コード例 #10
0
 /// <summary>
 /// Open <seealso cref="NeoStores"/> for requested and store types. If requested store depend from non request store,
 /// it will be automatically opened as well. </summary>
 /// <param name="createStoreIfNotExists"> - should store be created if it's not exist </param>
 /// <param name="storeTypes"> - types of stores to be opened. </param>
 /// <returns> container with opened stores </returns>
 public virtual NeoStores OpenNeoStores(bool createStoreIfNotExists, params StoreType[] storeTypes)
 {
     if (createStoreIfNotExists)
     {
         try
         {
             _fileSystemAbstraction.mkdirs(_databaseLayout.databaseDirectory());
         }
         catch (IOException e)
         {
             throw new UnderlyingStorageException("Could not create database directory: " + _databaseLayout.databaseDirectory(), e);
         }
     }
     return(new NeoStores(_databaseLayout, _config, _idGeneratorFactory, _pageCache, _logProvider, _fileSystemAbstraction, _versionContextSupplier, _recordFormats, createStoreIfNotExists, storeTypes, _openOptions));
 }
コード例 #11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void restoreDatabaseFiles(org.neo4j.kernel.impl.transaction.log.files.LogFiles backupLogFiles, java.io.File[] files) throws java.io.IOException
        private void RestoreDatabaseFiles(LogFiles backupLogFiles, File[] files)
        {
            if (files != null)
            {
                foreach (File file in files)
                {
                    if (file.Directory)
                    {
                        File destination = new File(_toDatabaseDir, file.Name);
                        _fs.mkdirs(destination);
                        _fs.copyRecursively(file, destination);
                    }
                    else
                    {
                        _fs.copyToDirectory(file, backupLogFiles.IsLogFile(file) ? _transactionLogsDirectory : _toDatabaseDir);
                    }
                }
            }
        }