internal DatabaseDiagnostics(DiagnosticsManager diagnosticsManager, NeoStoreDataSource neoStoreDataSource, DatabaseInfo databaseInfo) { this._diagnosticsManager = diagnosticsManager; this._neoStoreDataSource = neoStoreDataSource; this._databaseInfo = databaseInfo; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void logModuleSetUpError() public virtual void LogModuleSetUpError() { Config config = Config.defaults(); IdGeneratorFactory idGeneratorFactory = mock(typeof(IdGeneratorFactory)); Exception openStoresError = new Exception("Can't set up modules"); doThrow(openStoresError).when(idGeneratorFactory).create(any(typeof(File)), anyLong(), anyBoolean()); CommunityIdTypeConfigurationProvider idTypeConfigurationProvider = new CommunityIdTypeConfigurationProvider(); AssertableLogProvider logProvider = new AssertableLogProvider(); SimpleLogService logService = new SimpleLogService(logProvider, logProvider); PageCache pageCache = PageCacheRule.getPageCache(Fs.get()); Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependencies(idGeneratorFactory, idTypeConfigurationProvider, config, logService); NeoStoreDataSource dataSource = DsRule.getDataSource(Dir.databaseLayout(), Fs.get(), pageCache, dependencies); try { dataSource.Start(); fail("Exception expected"); } catch (Exception e) { assertEquals(openStoresError, e); } logProvider.AssertAtLeastOnce(inLog(typeof(NeoStoreDataSource)).warn(equalTo("Exception occurred while setting up store modules. Attempting to close things down."), equalTo(openStoresError))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAlwaysShutdownLifeEvenWhenCheckPointingFails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAlwaysShutdownLifeEvenWhenCheckPointingFails() { // Given FileSystemAbstraction fs = this.Fs.get(); PageCache pageCache = PageCacheRule.getPageCache(fs); DatabaseHealth databaseHealth = mock(typeof(DatabaseHealth)); when(databaseHealth.Healthy).thenReturn(true); IOException ex = new IOException("boom!"); doThrow(ex).when(databaseHealth).assertHealthy(typeof(IOException)); // <- this is a trick to simulate a failure during checkpointing Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependencies(databaseHealth); NeoStoreDataSource dataSource = DsRule.getDataSource(Dir.databaseLayout(), fs, pageCache, dependencies); dataSource.Start(); try { // When dataSource.Stop(); fail("it should have thrown"); } catch (LifecycleException e) { // Then assertEquals(ex, e.InnerException); } }
public virtual NeoStoreDataSource GetDataSource(DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache, DependencyResolver otherCustomOverriddenDependencies) { ShutdownAnyRunning(); StatementLocksFactory locksFactory = mock(typeof(StatementLocksFactory)); StatementLocks statementLocks = mock(typeof(StatementLocks)); Org.Neo4j.Kernel.impl.locking.Locks_Client locks = mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client)); when(statementLocks.Optimistic()).thenReturn(locks); when(statementLocks.Pessimistic()).thenReturn(locks); when(locksFactory.NewInstance()).thenReturn(statementLocks); JobScheduler jobScheduler = mock(typeof(JobScheduler), RETURNS_MOCKS); Monitors monitors = new Monitors(); Dependencies mutableDependencies = new Dependencies(otherCustomOverriddenDependencies); // Satisfy non-satisfied dependencies Config config = Dependency(mutableDependencies, typeof(Config), deps => Config.defaults()); config.augment(default_schema_provider, EMPTY.ProviderDescriptor.name()); LogService logService = Dependency(mutableDependencies, typeof(LogService), deps => new SimpleLogService(NullLogProvider.Instance)); IdGeneratorFactory idGeneratorFactory = Dependency(mutableDependencies, typeof(IdGeneratorFactory), deps => new DefaultIdGeneratorFactory(fs)); IdTypeConfigurationProvider idConfigurationProvider = Dependency(mutableDependencies, typeof(IdTypeConfigurationProvider), deps => new CommunityIdTypeConfigurationProvider()); DatabaseHealth databaseHealth = Dependency(mutableDependencies, typeof(DatabaseHealth), deps => new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance)); SystemNanoClock clock = Dependency(mutableDependencies, typeof(SystemNanoClock), deps => Clocks.nanoClock()); TransactionMonitor transactionMonitor = Dependency(mutableDependencies, typeof(TransactionMonitor), deps => new DatabaseTransactionStats()); DatabaseAvailabilityGuard databaseAvailabilityGuard = Dependency(mutableDependencies, typeof(DatabaseAvailabilityGuard), deps => new DatabaseAvailabilityGuard(DEFAULT_DATABASE_NAME, deps.resolveDependency(typeof(SystemNanoClock)), NullLog.Instance)); Dependency(mutableDependencies, typeof(DiagnosticsManager), deps => new DiagnosticsManager(NullLog.Instance)); Dependency(mutableDependencies, typeof(IndexProvider), deps => EMPTY); _dataSource = new NeoStoreDataSource(new TestDatabaseCreationContext(DEFAULT_DATABASE_NAME, databaseLayout, config, idGeneratorFactory, logService, mock(typeof(JobScheduler), RETURNS_MOCKS), mock(typeof(TokenNameLookup)), mutableDependencies, mockedTokenHolders(), locksFactory, mock(typeof(SchemaWriteGuard)), mock(typeof(TransactionEventHandlers)), IndexingService.NO_MONITOR, fs, transactionMonitor, databaseHealth, mock(typeof(LogFileCreationMonitor)), TransactionHeaderInformationFactory.DEFAULT, new CommunityCommitProcessFactory(), mock(typeof(InternalAutoIndexing)), mock(typeof(IndexConfigStore)), mock(typeof(ExplicitIndexProvider)), pageCache, new StandardConstraintSemantics(), monitors, new Tracers("null", NullLog.Instance, monitors, jobScheduler, clock), mock(typeof(Procedures)), Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited, databaseAvailabilityGuard, clock, new CanWrite(), new StoreCopyCheckPointMutex(), RecoveryCleanupWorkCollector.immediate(), new BufferedIdController(new BufferingIdGeneratorFactory(idGeneratorFactory, Org.Neo4j.Kernel.impl.store.id.IdReuseEligibility_Fields.Always, idConfigurationProvider), jobScheduler), DatabaseInfo.COMMUNITY, new TransactionVersionContextSupplier(), ON_HEAP, Collections.emptyList(), file => EMPTY_WATCHER, new GraphDatabaseFacade(), Iterables.empty())); return(_dataSource); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListExpectedFilesCorrectly() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldListExpectedFilesCorrectly() { // given (setup) required runtime subject dependencies NeoStoreDataSource neoStoreDataSource = GetNeoStoreDataSource(_graphDb); SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider); // when PrepareStoreCopyResponse prepareStoreCopyResponse = simpleCatchupClient.RequestListOfFilesFromServer(); simpleCatchupClient.Close(); // then ListOfDownloadedFilesMatchesServer(neoStoreDataSource, prepareStoreCopyResponse.Files); // and downloaded files are identical to source IList <File> expectedCountStoreFiles = ListServerExpectedNonReplayableFiles(neoStoreDataSource); foreach (File storeFileSnapshot in expectedCountStoreFiles) { FileContentEquals(DatabaseFileToClientFile(storeFileSnapshot), storeFileSnapshot); } // and AssertTransactionIdMatches(prepareStoreCopyResponse.LastTransactionId()); //and assertTrue("Expected an empty set of ids. Found size " + prepareStoreCopyResponse.IndexIds.size(), prepareStoreCopyResponse.IndexIds.Empty); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void listOfDownloadedFilesMatchesServer(org.neo4j.kernel.NeoStoreDataSource neoStoreDataSource, java.io.File[] files) throws java.io.IOException private void ListOfDownloadedFilesMatchesServer(NeoStoreDataSource neoStoreDataSource, File[] files) { IList <string> expectedStoreFiles = GetExpectedStoreFiles(neoStoreDataSource); IList <string> givenFile = java.util.files.Select(File.getName).ToList(); assertThat(givenFile, containsInAnyOrder(expectedStoreFiles.ToArray())); }
public override void Unregistered(NeoStoreDataSource ds) { outerInstance.storeCreationDate = -1; outerInstance.storeLogVersion = -1; outerInstance.isReadOnly = false; outerInstance.storeId = -1; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void databaseHealthShouldBeHealedOnStart() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void DatabaseHealthShouldBeHealedOnStart() { NeoStoreDataSource theDataSource = null; try { DatabaseHealth databaseHealth = new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLogProvider.Instance.getLog(typeof(DatabaseHealth))); Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependency(databaseHealth); theDataSource = DsRule.getDataSource(Dir.databaseLayout(), Fs.get(), PageCacheRule.getPageCache(Fs.get()), dependencies); databaseHealth.Panic(new Exception()); theDataSource.Start(); databaseHealth.AssertHealthy(typeof(Exception)); } finally { if (theDataSource != null) { theDataSource.Stop(); theDataSource.Shutdown(); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void start() throws Throwable public override void Start() { // When we have multiple dbs, this has to be suitably modified to get the right kernel and procedures NeoStoreDataSource dataSource = _dataSourceManager.DataSource; EmbeddedProxySPI embeddedProxySPI = dataSource.DependencyResolver.resolveDependency(typeof(EmbeddedProxySPI), Org.Neo4j.Graphdb.DependencyResolver_SelectionStrategy.ONLY); _dataCollectors.Add(DataCollectorModule.setupDataCollector(_procedures, _jobScheduler, dataSource.Kernel, _monitors, new DefaultValueMapper(embeddedProxySPI), _config)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static java.util.List<java.io.File> listServerExpectedNonReplayableFiles(org.neo4j.kernel.NeoStoreDataSource neoStoreDataSource) throws java.io.IOException private static IList <File> ListServerExpectedNonReplayableFiles(NeoStoreDataSource neoStoreDataSource) { using (Stream <StoreFileMetadata> countStoreStream = neoStoreDataSource.NeoStoreFileListing.builder().excludeAll().includeNeoStoreFiles().build().stream(), Stream <StoreFileMetadata> explicitIndexStream = neoStoreDataSource.NeoStoreFileListing.builder().excludeAll().includeExplicitIndexStoreStoreFiles().build().stream()) { //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: return(Stream.concat(countStoreStream.filter(IsCountFile(neoStoreDataSource.DatabaseLayout)), explicitIndexStream).map(StoreFileMetadata::file).collect(toList())); } }
public override void Registered(NeoStoreDataSource ds) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StoreSizeProvider dataProvider = new StoreSizeProvider(fs, ds); StoreSizeProvider dataProvider = new StoreSizeProvider(Fs, ds); this.Delegate = newThrottlingBeanSnapshotProxy(typeof(StoreSize), dataProvider, UpdateInterval, Clock); }
public StoreCopyServer(NeoStoreDataSource dataSource, CheckPointer checkPointer, FileSystemAbstraction fileSystem, File databaseDirectory, Monitor monitor) { this._dataSource = dataSource; this._checkPointer = checkPointer; this._fileSystem = fileSystem; this._databaseDirectory = getCanonicalFile(databaseDirectory); this._monitor = monitor; }
internal PageCacheWarmerKernelExtension(JobScheduler scheduler, DatabaseAvailabilityGuard databaseAvailabilityGuard, PageCache pageCache, FileSystemAbstraction fs, NeoStoreDataSource dataSource, Log log, PageCacheWarmerMonitor monitor, Config config) { this._databaseAvailabilityGuard = databaseAvailabilityGuard; this._dataSource = dataSource; this._config = config; _pageCacheWarmer = new PageCacheWarmer(fs, pageCache, scheduler, dataSource.DatabaseLayout.databaseDirectory()); _availabilityListener = new WarmupAvailabilityListener(scheduler, _pageCacheWarmer, config, log, monitor); }
public virtual void Register(NeoStoreDataSource dataSource) { _dataSources.Add(dataSource); if (_life.Status.Equals(LifecycleStatus.STARTED)) { _life.add(dataSource); _dsRegistrationListeners.notify(listener => listener.registered(dataSource)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.util.List<String> getExpectedStoreFiles(org.neo4j.kernel.NeoStoreDataSource neoStoreDataSource) throws java.io.IOException private IList <string> GetExpectedStoreFiles(NeoStoreDataSource neoStoreDataSource) { NeoStoreFileListing.StoreFileListingBuilder builder = neoStoreDataSource.NeoStoreFileListing.builder(); builder.ExcludeLogFiles().excludeExplicitIndexStoreFiles().excludeSchemaIndexStoreFiles().excludeAdditionalProviders(); using (Stream <StoreFileMetadata> stream = builder.Build().stream()) { return(stream.filter(IsCountFile(neoStoreDataSource.DatabaseLayout).negate()).map(sfm => sfm.file().Name).collect(toList())); } }
public override void Registered(NeoStoreDataSource ds) { StoreId id = ds.StoreId; outerInstance.storeLogVersion = ds.DependencyResolver.resolveDependency(typeof(LogVersionRepository)).CurrentLogVersion; outerInstance.storeCreationDate = id.CreationTime; outerInstance.isReadOnly = ds.ReadOnly; outerInstance.storeId = id.RandomId; outerInstance.databaseName = ds.DatabaseName; }
private static NeoStoreDataSource NeoStoreDataSourceWithLogFilesContainingLowestTxId(LogFiles files) { DependencyResolver resolver = mock(typeof(DependencyResolver)); when(resolver.ResolveDependency(typeof(LogFiles))).thenReturn(files); NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); when(dataSource.DependencyResolver).thenReturn(resolver); return(dataSource); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyLogFilesWithCustomPathListing(String path) throws java.io.IOException private void VerifyLogFilesWithCustomPathListing(string path) { GraphDatabaseAPI graphDatabase = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(TestDirectory.databaseDir("customDb")).setConfig(GraphDatabaseSettings.logical_logs_location, path).newGraphDatabase(); NeoStoreDataSource dataSource = graphDatabase.DependencyResolver.resolveDependency(typeof(NeoStoreDataSource)); LogFiles logFiles = graphDatabase.DependencyResolver.resolveDependency(typeof(LogFiles)); assertTrue(dataSource.ListStoreFiles(true).Any(metadata => metadata.LogFile && logFiles.IsLogFile(metadata.file()))); assertEquals(Paths.get(path).FileName.ToString(), logFiles.LogFilesDirectory().Name); graphDatabase.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void provideAccessOnlyToActiveDatabase() internal virtual void ProvideAccessOnlyToActiveDatabase() { DataSourceManager manager = CreateDataSourceManager(); NeoStoreDataSource dataSource1 = mock(typeof(NeoStoreDataSource)); NeoStoreDataSource dataSource2 = mock(typeof(NeoStoreDataSource)); when(dataSource1.DatabaseLayout).thenReturn(_testDirectory.databaseLayout()); when(dataSource2.DatabaseLayout).thenReturn(_testDirectory.databaseLayout("somethingElse")); manager.Register(dataSource1); manager.Register(dataSource2); assertEquals(dataSource1, manager.DataSource); }
internal StoreSizeProvider(FileSystemAbstraction fs, NeoStoreDataSource ds) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.graphdb.DependencyResolver deps = ds.getDependencyResolver(); DependencyResolver deps = ds.DependencyResolver; this.Fs = requireNonNull(fs); this.LogFiles = deps.ResolveDependency(typeof(LogFiles)); this.ExplicitIndexProviderLookup = deps.ResolveDependency(typeof(ExplicitIndexProvider)); this.IndexProviderMap = deps.ResolveDependency(typeof(IndexProviderMap)); this.LabelScanStore = deps.ResolveDependency(typeof(LabelScanStore)); this.DatabaseLayout = ds.DatabaseLayout; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void flushOfThePageCacheOnShutdownHappensIfTheDbIsHealthy() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FlushOfThePageCacheOnShutdownHappensIfTheDbIsHealthy() { PageCache pageCache = spy(PageCacheRule.getPageCache(Fs.get())); NeoStoreDataSource ds = DsRule.getDataSource(Dir.databaseLayout(), Fs.get(), pageCache); ds.Start(); verify(pageCache, never()).flushAndForce(); ds.Stop(); ds.Shutdown(); verify(pageCache).flushAndForce(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogCorrectTransactionLogDiagnosticsForNoTransactionLogs() public virtual void ShouldLogCorrectTransactionLogDiagnosticsForNoTransactionLogs() { // GIVEN NeoStoreDataSource dataSource = NeoStoreDataSourceWithLogFilesContainingLowestTxId(NoLogs()); AssertableLogProvider logProvider = new AssertableLogProvider(); Logger logger = logProvider.getLog(this.GetType()).infoLogger(); // WHEN DataSourceDiagnostics.TransactionRange.dump(dataSource, logger); // THEN logProvider.RawMessageMatcher().assertContains("No transactions"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void flushOfThePageCacheHappensOnlyOnceDuringShutdown() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FlushOfThePageCacheHappensOnlyOnceDuringShutdown() { PageCache pageCache = spy(PageCacheRule.getPageCache(Fs.get())); NeoStoreDataSource ds = DsRule.getDataSource(Dir.databaseLayout(), Fs.get(), pageCache); ds.Start(); verify(pageCache, never()).flushAndForce(); verify(pageCache, never()).flushAndForce(any(typeof(IOLimiter))); ds.Stop(); ds.Shutdown(); verify(pageCache).flushAndForce(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private SwitchToSlaveCopyThenBranch newSwitchToSlaveSpy(org.neo4j.io.pagecache.PageCache pageCacheMock, org.neo4j.com.storecopy.StoreCopyClient storeCopyClient) private SwitchToSlaveCopyThenBranch NewSwitchToSlaveSpy(PageCache pageCacheMock, StoreCopyClient storeCopyClient) { ClusterMembers clusterMembers = mock(typeof(ClusterMembers)); ClusterMember master = mock(typeof(ClusterMember)); when(master.StoreId).thenReturn(_storeId); when(master.HARole).thenReturn(HighAvailabilityModeSwitcher.MASTER); when(master.HasRole(eq(HighAvailabilityModeSwitcher.MASTER))).thenReturn(true); when(master.InstanceId).thenReturn(new InstanceId(1)); when(clusterMembers.Members).thenReturn(asList(master)); Dependencies resolver = new Dependencies(); DatabaseAvailability databaseAvailability = mock(typeof(DatabaseAvailability)); when(databaseAvailability.Started).thenReturn(true); resolver.SatisfyDependencies(_requestContextFactory, clusterMembers, mock(typeof(TransactionObligationFulfiller)), mock(typeof(OnlineBackupKernelExtension)), mock(typeof(IndexConfigStore)), mock(typeof(TransactionCommittingResponseUnpacker)), mock(typeof(DataSourceManager)), mock(typeof(StoreLockerLifecycleAdapter)), mock(typeof(FileSystemWatcherService)), databaseAvailability); NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); when(dataSource.StoreId).thenReturn(_storeId); when(dataSource.DependencyResolver).thenReturn(resolver); DatabaseTransactionStats transactionCounters = mock(typeof(DatabaseTransactionStats)); when(transactionCounters.NumberOfActiveTransactions).thenReturn(0L); Response <HandshakeResult> response = mock(typeof(Response)); when(response.ResponseConflict()).thenReturn(new HandshakeResult(42, 2)); when(_masterClient.handshake(anyLong(), any(typeof(StoreId)))).thenReturn(response); when(_masterClient.ProtocolVersion).thenReturn(Org.Neo4j.Kernel.ha.com.slave.MasterClient_Fields.Current); TransactionIdStore transactionIdStoreMock = mock(typeof(TransactionIdStore)); // note that the checksum (the second member of the array) is the same as the one in the handshake mock above when(transactionIdStoreMock.LastCommittedTransaction).thenReturn(new TransactionId(42, 42, 42)); MasterClientResolver masterClientResolver = mock(typeof(MasterClientResolver)); when(masterClientResolver.Instantiate(anyString(), anyInt(), anyString(), any(typeof(Monitors)), argThat(_storeId => true), any(typeof(LifeSupport)))).thenReturn(_masterClient); return(spy(new SwitchToSlaveCopyThenBranch(TestDirectory.databaseLayout(), NullLogService.Instance, ConfigMock(), mock(typeof(HaIdGeneratorFactory)), mock(typeof(DelegateInvocationHandler)), mock(typeof(ClusterMemberAvailability)), _requestContextFactory, _pullerFactory, masterClientResolver, mock(typeof(SwitchToSlave.Monitor)), storeCopyClient, Suppliers.singleton(dataSource), Suppliers.singleton(transactionIdStoreMock), slave => { SlaveServer server = mock(typeof(SlaveServer)); InetSocketAddress inetSocketAddress = InetSocketAddress.createUnresolved("localhost", 42); when(server.SocketAddress).thenReturn(inetSocketAddress); return server; }, _updatePuller, pageCacheMock, mock(typeof(Monitors)), () => transactionCounters))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() throws javax.management.NotCompliantMBeanException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Setup() { DataSourceManager dataSourceManager = new DataSourceManager(Config.defaults()); _fileSystem = new DefaultFileSystemAbstraction(); _kernelData = new TestHighlyAvailableKernelData(this, dataSourceManager); ManagementData data = new ManagementData(_bean, _kernelData, ManagementSupport.load()); NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); when(dataSource.DatabaseLayout).thenReturn(TestDirectory.databaseLayout()); dataSourceManager.Register(dataSource); when(dataSource.DependencyResolver).thenReturn(_dependencies); _dependencies.satisfyDependency(DatabaseInfo.HA); _haBean = ( HighAvailability )(new HighAvailabilityBean()).CreateMBean(data); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogCorrectTransactionLogDiagnosticsForTransactionsInSecondOldestLog() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogCorrectTransactionLogDiagnosticsForTransactionsInSecondOldestLog() { // GIVEN long logVersion = 2; long prevLogLastTxId = 45; NeoStoreDataSource dataSource = NeoStoreDataSourceWithLogFilesContainingLowestTxId(LogWithTransactionsInNextToOldestLog(logVersion, prevLogLastTxId)); AssertableLogProvider logProvider = new AssertableLogProvider(); Logger logger = logProvider.getLog(this.GetType()).infoLogger(); // WHEN DataSourceDiagnostics.TransactionRange.dump(dataSource, logger); // THEN logProvider.RawMessageMatcher().assertContains("transaction " + (prevLogLastTxId + 1)); logProvider.RawMessageMatcher().assertContains("version " + (logVersion + 1)); }
//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() { NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); _fileListingBuilder = mock(typeof(NeoStoreFileListing.StoreFileListingBuilder), CALLS_REAL_METHODS); _databaseLayout = TestDirectory.databaseLayout(); when(dataSource.DatabaseLayout).thenReturn(_databaseLayout); _indexListingMock = mock(typeof(NeoStoreFileIndexListing)); when(_indexListingMock.IndexIds).thenReturn(new LongHashSet()); NeoStoreFileListing storeFileListing = mock(typeof(NeoStoreFileListing)); when(storeFileListing.NeoStoreFileIndexListing).thenReturn(_indexListingMock); when(storeFileListing.Builder()).thenReturn(_fileListingBuilder); when(dataSource.NeoStoreFileListing).thenReturn(storeFileListing); _prepareStoreCopyFiles = new PrepareStoreCopyFiles(dataSource, _fileSystemAbstraction); }
public DefaultMasterImplSPI(GraphDatabaseAPI graphDb, FileSystemAbstraction fileSystemAbstraction, Monitors monitors, TokenHolders tokenHolders, IdGeneratorFactory idGeneratorFactory, TransactionCommitProcess transactionCommitProcess, CheckPointer checkPointer, TransactionIdStore transactionIdStore, LogicalTransactionStore logicalTransactionStore, NeoStoreDataSource neoStoreDataSource, LogProvider logProvider) { this._graphDb = graphDb; this._fileSystem = fileSystemAbstraction; this._tokenHolders = tokenHolders; this._idGeneratorFactory = idGeneratorFactory; this._transactionCommitProcess = transactionCommitProcess; this._checkPointer = checkPointer; this._neoStoreDataSource = neoStoreDataSource; this._databaseDirectory = graphDb.DatabaseLayout().databaseDirectory(); this._txChecksumLookup = new TransactionChecksumLookup(transactionIdStore, logicalTransactionStore); this._responsePacker = new ResponsePacker(logicalTransactionStore, transactionIdStore, graphDb.storeId); this._monitors = monitors; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: monitors.AddMonitorListener(new LoggingStoreCopyServerMonitor(logProvider.GetLog(typeof(StoreCopyServer))), typeof(StoreCopyServer).FullName); }
public override Lifecycle NewInstance(KernelContext context, Dependencies deps) { JobScheduler scheduler = deps.JobScheduler(); DatabaseAvailabilityGuard databaseAvailabilityGuard = deps.AvailabilityGuard(); PageCache pageCache = deps.PageCache(); FileSystemAbstraction fs = deps.FileSystemAbstraction(); LogService logService = deps.LogService(); NeoStoreDataSource dataSourceManager = deps.DataSource; Log log = logService.GetInternalLog(typeof(PageCacheWarmer)); Monitors monitors = deps.Monitors(); PageCacheWarmerMonitor monitor = monitors.NewMonitor(typeof(PageCacheWarmerMonitor)); monitors.AddMonitorListener(new PageCacheWarmerLoggingMonitor(log)); Config config = deps.Config(); return(new PageCacheWarmerKernelExtension(scheduler, databaseAvailabilityGuard, pageCache, fs, dataSourceManager, log, monitor, config)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldSupportMultipleStartStopCycles() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldSupportMultipleStartStopCycles() { // given DataSourceManager manager = CreateDataSourceManager(); NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); manager.Register(dataSource); manager.Init(); // when manager.Start(); manager.Stop(); manager.Start(); // then verify(dataSource, times(2)).start(); }