//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void updatesPulledAndPullingScheduledOnSwitchToSlave() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UpdatesPulledAndPullingScheduledOnSwitchToSlave() { SwitchToSlaveCopyThenBranch switchToSlave = NewSwitchToSlaveSpy(); when(_fs.fileExists(any(typeof(File)))).thenReturn(true); JobScheduler jobScheduler = mock(typeof(JobScheduler)); LifeSupport communicationLife = mock(typeof(LifeSupport)); URI localhost = LocalhostUri; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.ha.UpdatePullerScheduler pullerScheduler = new org.neo4j.kernel.ha.UpdatePullerScheduler(jobScheduler, org.neo4j.logging.NullLogProvider.getInstance(), updatePuller, 10L); UpdatePullerScheduler pullerScheduler = new UpdatePullerScheduler(jobScheduler, NullLogProvider.Instance, _updatePuller, 10L); when(_pullerFactory.createUpdatePullerScheduler(_updatePuller)).thenReturn(pullerScheduler); // emulate lifecycle start call on scheduler doAnswer(invocationOnMock => { pullerScheduler.Init(); return(null); }).when(communicationLife).start(); switchToSlave.SwitchToSlaveConflict(communicationLife, localhost, localhost, mock(typeof(CancellationRequest))); verify(_updatePuller).tryPullUpdates(); verify(communicationLife).add(pullerScheduler); verify(jobScheduler).scheduleRecurring(eq(Group.PULL_UPDATES), any(typeof(ThreadStart)), eq(10L), eq(10L), eq(TimeUnit.MILLISECONDS)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.net.URI startHaCommunication(org.neo4j.kernel.lifecycle.LifeSupport haCommunicationLife, org.neo4j.kernel.NeoStoreDataSource neoDataSource, java.net.URI me, java.net.URI masterUri, org.neo4j.storageengine.api.StoreId storeId, org.neo4j.helpers.CancellationRequest cancellationRequest) throws IllegalArgumentException, InterruptedException private URI StartHaCommunication(LifeSupport haCommunicationLife, NeoStoreDataSource neoDataSource, URI me, URI masterUri, StoreId storeId, CancellationRequest cancellationRequest) { MasterClient master = NewMasterClient(masterUri, me, neoDataSource.StoreId, haCommunicationLife); TransactionObligationFulfiller obligationFulfiller = ResolveDatabaseDependency(typeof(TransactionObligationFulfiller)); UpdatePullerScheduler updatePullerScheduler = _updatePullerFactory.createUpdatePullerScheduler(UpdatePuller); Slave slaveImpl = new SlaveImpl(obligationFulfiller); SlaveServer server = _slaveServerFactory.apply(slaveImpl); if (cancellationRequest.CancellationRequested()) { MsgLog.info("Switch to slave cancelled, unable to start HA-communication"); return(null); } _masterDelegateHandler.Delegate = master; haCommunicationLife.Add(updatePullerScheduler); haCommunicationLife.Add(server); haCommunicationLife.Start(); /* * Take the opportunity to catch up with master, now that we're alone here, right before we * drop the availability guard, so that other transactions might start. */ if (!CatchUpWithMaster(UpdatePuller)) { return(null); } URI slaveHaURI = CreateHaURI(me, server); _clusterMemberAvailability.memberIsAvailable(HighAvailabilityModeSwitcher.SLAVE, slaveHaURI, storeId); return(slaveHaURI); }