//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDefaultTimeoutToTwentyMinutes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldDefaultTimeoutToTwentyMinutes() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext("--backup-dir=/", "--name=mybackup"); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals(MINUTES.toMillis(20), requiredArguments.Timeout); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: static String formatInterval(final long l) internal static string FormatInterval(long l) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long hr = MILLISECONDS.toHours(l); long hr = MILLISECONDS.toHours(l); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long min = MILLISECONDS.toMinutes(l - HOURS.toMillis(hr)); long min = MILLISECONDS.toMinutes(l - HOURS.toMillis(hr)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long sec = MILLISECONDS.toSeconds(l - HOURS.toMillis(hr) - MINUTES.toMillis(min)); long sec = MILLISECONDS.toSeconds(l - HOURS.toMillis(hr) - MINUTES.toMillis(min)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long ms = l - HOURS.toMillis(hr) - MINUTES.toMillis(min) - SECONDS.toMillis(sec); long ms = l - HOURS.toMillis(hr) - MINUTES.toMillis(min) - SECONDS.toMillis(sec); return(string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", hr, min, sec, ms)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldNotTimeoutSchemaTransactions() internal virtual void ShouldNotTimeoutSchemaTransactions() { // given KernelTransactions kernelTransactions = mock(typeof(KernelTransactions)); FakeClock clock = new FakeClock(100, MINUTES); KernelTransactionMonitor monitor = new KernelTransactionMonitor(kernelTransactions, clock, NullLogService.Instance); // a 2 minutes old schema transaction which has a timeout of 1 minute KernelTransactionHandle oldSchemaTransaction = mock(typeof(KernelTransactionHandle)); when(oldSchemaTransaction.SchemaTransaction).thenReturn(true); when(oldSchemaTransaction.StartTime()).thenReturn(clock.Millis() - MINUTES.toMillis(2)); when(oldSchemaTransaction.TimeoutMillis()).thenReturn(MINUTES.toMillis(1)); when(kernelTransactions.ActiveTransactions()).thenReturn(Iterators.asSet(oldSchemaTransaction)); // when monitor.Run(); // then verify(oldSchemaTransaction, times(1)).SchemaTransaction; verify(oldSchemaTransaction, never()).markForTermination(any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UpgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() { // Given _fileSystem.deleteFile(_databaseLayout.file(INTERNAL_LOG_FILE)); PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache); // When NewUpgrader(upgradableDatabase, _allowMigrateConfig, pageCache).migrateIfNeeded(_databaseLayout); // Then StoreFactory factory = new StoreFactory(_databaseLayout, _allowMigrateConfig, new DefaultIdGeneratorFactory(_fileSystem), pageCache, _fileSystem, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); using (NeoStores neoStores = factory.OpenAllNeoStores()) { assertThat(neoStores.MetaDataStore.UpgradeTransaction, equalTo(neoStores.MetaDataStore.LastCommittedTransaction)); assertThat(neoStores.MetaDataStore.UpgradeTime, not(equalTo(MetaDataStore.FIELD_NOT_INITIALIZED))); long minuteAgo = DateTimeHelper.CurrentUnixTimeMillis() - MINUTES.toMillis(1); assertThat(neoStores.MetaDataStore.UpgradeTime, greaterThan(minuteAgo)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDelayFreeingOfAggressivelyReusedIdsConsideringTimeAsWell() public virtual void ShouldDelayFreeingOfAggressivelyReusedIdsConsideringTimeAsWell() { // GIVEN MockedIdGeneratorFactory actual = new MockedIdGeneratorFactory(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.time.FakeClock clock = org.neo4j.time.Clocks.fakeClock(); FakeClock clock = Clocks.fakeClock(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long safeZone = MINUTES.toMillis(1); long safeZone = MINUTES.toMillis(1); ControllableSnapshotSupplier boundaries = new ControllableSnapshotSupplier(); BufferingIdGeneratorFactory bufferingIdGeneratorFactory = new BufferingIdGeneratorFactory(actual, t => clock.Millis() - t.snapshotTime() >= safeZone, new CommunityIdTypeConfigurationProvider()); bufferingIdGeneratorFactory.Initialize(boundaries); IdGenerator idGenerator = bufferingIdGeneratorFactory.Open(new File("doesnt-matter"), 10, IdType.StringBlock, () => 0L, int.MaxValue); // WHEN idGenerator.FreeId(7); verifyNoMoreInteractions(actual.Get(IdType.StringBlock)); // after some maintenance and transaction still not closed bufferingIdGeneratorFactory.Maintenance(); verifyNoMoreInteractions(actual.Get(IdType.StringBlock)); // although after transactions have all closed boundaries.SetMostRecentlyReturnedSnapshotToAllClosed(); bufferingIdGeneratorFactory.Maintenance(); // ... the clock would still say "nope" so no interaction verifyNoMoreInteractions(actual.Get(IdType.StringBlock)); // then finally after time has passed as well clock.Forward(70, SECONDS); bufferingIdGeneratorFactory.Maintenance(); // THEN verify(actual.Get(IdType.StringBlock)).freeId(7); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void displayDuration() internal virtual void DisplayDuration() { assertThat(duration(MINUTES.toMillis(1) + SECONDS.toMillis(2)), @is("1m 2s")); assertThat(duration(42), @is("42ms")); assertThat(duration(0), @is("0ms")); }