//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fileWatcherFileNameFilter() public virtual void FileWatcherFileNameFilter() { DatabaseLayout layout = _testDirectory.databaseLayout(); System.Predicate <string> filter = EnterpriseCoreEditionModule.FileWatcherFileNameFilter(); assertFalse(filter(layout.MetadataStore().Name)); assertFalse(filter(layout.NodeStore().Name)); assertTrue(filter(TransactionLogFiles.DEFAULT_NAME + ".1")); assertTrue(filter(IndexConfigStore.INDEX_DB_FILE_NAME + ".any")); assertTrue(filter(layout.MetadataStore().Name + PageCacheWarmer.SUFFIX_CACHEPROF)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateTransactionInformationWhenLogsAreEmpty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGenerateTransactionInformationWhenLogsAreEmpty() { // given long txId = 1; DatabaseLayout databaseLayout = _directory.databaseLayout(); File neoStore = databaseLayout.MetadataStore(); neoStore.createNewFile(); Config config = mock(typeof(Config)); LogService logService = new SimpleLogService(NullLogProvider.Instance, NullLogProvider.Instance); // when // ... transaction info not in neo store assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_ID)); assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM)); assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP)); // ... and with migrator StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler); TransactionId actual = migrator.ExtractTransactionIdInformation(neoStore, txId); // then assertEquals(txId, actual.TransactionIdConflict()); assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_CHECKSUM, actual.Checksum()); assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_COMMIT_TIMESTAMP, actual.CommitTimestamp()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static java.io.File createNeoStoreFile(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException private static File CreateNeoStoreFile(FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout) { File neoStoreFile = databaseLayout.MetadataStore(); fileSystem.Create(neoStoreFile).close(); return(neoStoreFile); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void extractTransactionalInformationFromLogs(String path, java.io.File customLogLocation, org.neo4j.io.layout.DatabaseLayout databaseLayout, java.io.File storeDir) throws java.io.IOException private void ExtractTransactionalInformationFromLogs(string path, File customLogLocation, DatabaseLayout databaseLayout, File storeDir) { LogService logService = new SimpleLogService(NullLogProvider.Instance, NullLogProvider.Instance); File neoStore = databaseLayout.MetadataStore(); GraphDatabaseService database = (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(storeDir).setConfig(logical_logs_location, path).newGraphDatabase(); for (int i = 0; i < 10; i++) { using (Transaction transaction = database.BeginTx()) { Node node = database.CreateNode(); transaction.Success(); } } database.Shutdown(); MetaDataStore.setRecord(_pageCache, neoStore, MetaDataStore.Position.LAST_CLOSED_TRANSACTION_LOG_VERSION, MetaDataRecordFormat.FIELD_NOT_PRESENT); Config config = Config.defaults(logical_logs_location, path); StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler); LogPosition logPosition = migrator.ExtractTransactionLogPosition(neoStore, databaseLayout, 100); File[] logFiles = customLogLocation.listFiles(); assertNotNull(logFiles); assertEquals(0, logPosition.LogVersion); assertEquals(logFiles[0].length(), logPosition.ByteOffset); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldExtractTransactionInformationFromMetaDataStore() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldExtractTransactionInformationFromMetaDataStore() { // given // ... variables long txId = 42; long checksum = 123456789123456789L; long timestamp = 919191919191919191L; TransactionId expected = new TransactionId(txId, checksum, timestamp); // ... and files DatabaseLayout databaseLayout = _directory.databaseLayout(); File neoStore = databaseLayout.MetadataStore(); neoStore.createNewFile(); // ... and mocks Config config = mock(typeof(Config)); LogService logService = mock(typeof(LogService)); // when // ... data in record setRecord(_pageCache, neoStore, LAST_TRANSACTION_ID, txId); setRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM, checksum); setRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP, timestamp); // ... and with migrator StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler); TransactionId actual = migrator.ExtractTransactionIdInformation(neoStore, txId); // then assertEquals(expected, actual); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void fileWatcherFileNameFilter() internal virtual void FileWatcherFileNameFilter() { DatabaseLayout layout = _testDirectory.databaseLayout(); System.Predicate <string> filter = CommunityEditionModule.CommunityFileWatcherFileNameFilter(); assertFalse(filter(layout.MetadataStore().Name)); assertFalse(filter(layout.NodeStore().Name)); assertTrue(filter(TransactionLogFiles.DEFAULT_NAME + ".1")); assertTrue(filter(IndexConfigStore.INDEX_DB_FILE_NAME + ".any")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fileWatcherFileNameFilter() public virtual void FileWatcherFileNameFilter() { DatabaseLayout databaseLayout = ClusterRule.TestDirectory.databaseLayout(); System.Predicate <string> filter = HighlyAvailableEditionModule.FileWatcherFileNameFilter(); string metadataStoreName = databaseLayout.MetadataStore().Name; assertFalse(filter(metadataStoreName)); assertFalse(filter(databaseLayout.NodeStore().Name)); assertTrue(filter(TransactionLogFiles.DEFAULT_NAME + ".1")); assertTrue(filter(IndexConfigStore.INDEX_DB_FILE_NAME + ".any")); assertTrue(filter(StoreUtil.BRANCH_SUBDIRECTORY)); assertTrue(filter(StoreUtil.TEMP_COPY_DIRECTORY_NAME)); assertTrue(filter(metadataStoreName + PageCacheWarmer.SUFFIX_CACHEPROF)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotMigrateFilesForVersionsWithSameCapability() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotMigrateFilesForVersionsWithSameCapability() { // Prepare migrator and file StoreMigrator migrator = NewStoreMigrator(); DatabaseLayout dbLayout = _directory.databaseLayout(); File neoStore = dbLayout.MetadataStore(); neoStore.createNewFile(); // Monitor what happens MyProgressReporter progressReporter = new MyProgressReporter(); // Migrate with two storeversions that have the same FORMAT capabilities migrator.Migrate(dbLayout, _directory.databaseLayout("migrationDir"), progressReporter, StandardV3_0.STORE_VERSION, StandardV3_2.STORE_VERSION); // Should not have started any migration assertFalse(progressReporter.Started); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCountFileSizeRecursively() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCountFileSizeRecursively() { // file structure: // storeDir/indexDir/indexFile (1 kB) // storeDir/neostore (3 kB) File storeDir = DirectoryConflict.directory("storeDir"); DatabaseLayout layout = DatabaseLayout.of(storeDir); File indexDir = Directory(storeDir, "indexDir"); File(indexDir, "indexFile", ( int )kibiBytes(1)); File(storeDir, layout.MetadataStore().Name, (int)kibiBytes(3)); AssertableLogProvider logProvider = new AssertableLogProvider(); KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout); storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger()); logProvider.RawMessageMatcher().assertContains("Total size of store: 4.00 kB"); logProvider.RawMessageMatcher().assertContains("Total size of mapped files: 3.00 kB"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public ReadOnlyTransactionIdStore(org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException public ReadOnlyTransactionIdStore(PageCache pageCache, DatabaseLayout databaseLayout) { long id = 0; long checksum = 0; long logVersion = 0; long byteOffset = 0; if (NeoStores.isStorePresent(pageCache, databaseLayout)) { File neoStore = databaseLayout.MetadataStore(); id = getRecord(pageCache, neoStore, Position.LAST_TRANSACTION_ID); checksum = getRecord(pageCache, neoStore, Position.LAST_TRANSACTION_CHECKSUM); logVersion = getRecord(pageCache, neoStore, Position.LAST_CLOSED_TRANSACTION_LOG_VERSION); byteOffset = getRecord(pageCache, neoStore, Position.LAST_CLOSED_TRANSACTION_LOG_BYTE_OFFSET); } this._transactionId = id; this._transactionChecksum = checksum; this._logVersion = logVersion; this._byteOffset = byteOffset; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public ReadOnlyLogVersionRepository(org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException public ReadOnlyLogVersionRepository(PageCache pageCache, DatabaseLayout databaseLayout) { File neoStore = databaseLayout.MetadataStore(); this._logVersion = ReadLogVersion(pageCache, neoStore); }
public static bool CheckNeoStoreHasDefaultFormatVersion(StoreVersionCheck check, DatabaseLayout databaseLayout) { File metadataStore = databaseLayout.MetadataStore(); return(check.HasVersion(metadataStore, RecordFormatSelector.defaultFormat().storeVersion()).Outcome.Successful); }