//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getUpgradeTransactionShouldFailWhenStoreIsClosed() public virtual void getUpgradeTransactionShouldFailWhenStoreIsClosed() { MetaDataStore metaDataStore = NewMetaDataStore(); metaDataStore.Close(); try { metaDataStore.UpgradeTransaction; fail("Expected exception reading from MetaDataStore after being closed."); } catch (Exception e) { assertThat(e, instanceOf(typeof(System.InvalidOperationException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getLatestConstraintIntroducingTxShouldFailWhenStoreIsClosed() public virtual void getLatestConstraintIntroducingTxShouldFailWhenStoreIsClosed() { MetaDataStore metaDataStore = NewMetaDataStore(); metaDataStore.Close(); try { metaDataStore.LatestConstraintIntroducingTx; fail("Expected exception reading from MetaDataStore after being closed."); } catch (Exception e) { assertThat(e, instanceOf(typeof(System.InvalidOperationException))); } }
public static bool IsStorePresent(PageCache pageCache, DatabaseLayout databaseLayout) { File metaDataStore = databaseLayout.MetadataStore(); try { using (PagedFile ignore = pageCache.Map(metaDataStore, MetaDataStore.GetPageSize(pageCache))) { return(true); } } catch (IOException) { return(false); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void currentCommittingTransactionId() public virtual void CurrentCommittingTransactionId() { MetaDataStore metaDataStore = NewMetaDataStore(); metaDataStore.NextCommittingTransactionId(); long lastCommittingTxId = metaDataStore.NextCommittingTransactionId(); assertEquals(lastCommittingTxId, metaDataStore.CommittingTransactionId()); metaDataStore.NextCommittingTransactionId(); metaDataStore.NextCommittingTransactionId(); lastCommittingTxId = metaDataStore.NextCommittingTransactionId(); assertEquals(lastCommittingTxId, metaDataStore.CommittingTransactionId()); metaDataStore.Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void incrementAndGetVersionMustBeAtomic() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void IncrementAndGetVersionMustBeAtomic() { using (MetaDataStore store = NewMetaDataStore()) { long initialVersion = store.IncrementAndGetVersion(); int threads = Runtime.Runtime.availableProcessors(); int iterations = 500; Race race = new Race(); race.AddContestants(threads, () => { for (int i = 0; i < iterations; i++) { store.IncrementAndGetVersion(); } }); race.Go(); assertThat(store.IncrementAndGetVersion(), @is(initialVersion + (threads * iterations) + 1)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustSupportScanningAllRecordsWithRecordCursor() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustSupportScanningAllRecordsWithRecordCursor() { File file = CreateMetaDataFile(); MetaDataStore.Position[] positions = MetaDataStore.Position.values(); long storeVersion = versionStringToLong(Standard.LATEST_RECORD_FORMATS.storeVersion()); WriteCorrectMetaDataRecord(file, positions, storeVersion); IList <long> actualValues = new List <long>(); using (MetaDataStore store = NewMetaDataStore()) { MetaDataRecord record = store.NewRecord(); using (PageCursor cursor = store.OpenPageCursorForReading(0)) { long highId = store.HighId; for (long id = 0; id < highId; id++) { store.GetRecordByCursor(id, record, RecordLoad.NORMAL, cursor); if (record.InUse()) { actualValues.Add(record.Value); } } } } IList <long> expectedValues = java.util.positions.Select(p => { if (p == MetaDataStore.Position.StoreVersion) { return(storeVersion); } else { return(p.ordinal() + 1L); } }).ToList(); assertThat(actualValues, @is(expectedValues)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = UnderlyingStorageException.class) public void staticSetRecordMustThrowOnPageOverflow() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void StaticSetRecordMustThrowOnPageOverflow() { _fakePageCursorOverflow = true; MetaDataStore.SetRecord(_pageCacheWithFakeOverflow, CreateMetaDataFile(), MetaDataStore.Position.FirstGraphProperty, 4242); }