示例#1
0
 public virtual void AssertDatabaseIsEmptyOrNonExistent()
 {
     if (DatabaseExistsAndContainsData())
     {
         throw new System.InvalidOperationException(_databaseLayout.databaseDirectory() + " already contains data, cannot do import here");
     }
 }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _databaseLayout = _testDirectory.databaseLayout();
            _storeDir       = _databaseLayout.databaseDirectory();
            _fileSystem     = _fileSystemRule.get();
            (new TestGraphDatabaseFactory()).setFileSystem(_fileSystem).newImpermanentDatabase(_storeDir).shutdown();
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TemporaryStoreDirectory(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, java.io.File parent) throws java.io.IOException
        public TemporaryStoreDirectory(FileSystemAbstraction fs, PageCache pageCache, File parent)
        {
            this._tempStoreDir       = new File(parent, TEMP_COPY_DIRECTORY_NAME);
            this._tempDatabaseLayout = DatabaseLayout.of(_tempStoreDir, GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
            _storeFiles   = new StoreFiles(fs, pageCache, (directory, name) => true);
            _tempLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_tempDatabaseLayout.databaseDirectory(), fs).build();
            _storeFiles.delete(_tempStoreDir, _tempLogFiles);
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _backupLayout          = TestDirectory.databaseLayout("backups");
            _backupDir             = _backupLayout.databaseDirectory().toPath();
            _fs                    = new DefaultFileSystemAbstraction();
            _jobScheduler          = new ThreadPoolJobScheduler();
            _pageCache             = StandalonePageCacheFactory.createPageCache(_fs, _jobScheduler);
            _backupProtocolService = _backupProtocolService();
            _backupTool            = new BackupTool(_backupProtocolService, mock(typeof(PrintStream)));
        }
示例#5
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);
        }
示例#6
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));
 }
示例#7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doImport(org.neo4j.unsafe.impl.batchimport.input.Input input) throws java.io.IOException
        public override void DoImport(Input input)
        {
            using (BatchingNeoStores store = instantiateNeoStores(_fileSystem, _directoryStructure.databaseDirectory(), _externalPageCache, _recordFormats, _config, _logService, _additionalInitialIds, _dbConfig, _jobScheduler), ImportLogic logic = new ImportLogic(_directoryStructure.databaseDirectory(), _fileSystem, store, _config, _logService, _executionMonitor, _recordFormats, _monitor))
            {
                store.CreateNew();
                logic.Initialize(input);

                logic.ImportNodes();
                logic.PrepareIdMapper();
                logic.ImportRelationships();
                logic.CalculateNodeDegrees();
                logic.LinkRelationshipsOfAllTypes();
                logic.DefragmentRelationshipGroups();
                logic.BuildCountsStore();

                logic.Success();
            }
        }