Esempio n. 1
0
        private MetaDataStore NewMetaDataStore()
        {
            LogProvider  logProvider  = NullLogProvider.Instance;
            StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs), _pageCacheWithFakeOverflow, _fs, logProvider, EmptyVersionContextSupplier.EMPTY);

            return(storeFactory.OpenNeoStores(true, StoreType.MetaData).MetaDataStore);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAbortLoadingGroupChainIfComeTooFar()
        public virtual void ShouldAbortLoadingGroupChainIfComeTooFar()
        {
            // GIVEN a node with relationship group chain 2-->4-->10-->23
            LogProvider  logProvider  = NullLogProvider.Instance;
            StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), _pageCache.getPageCache(_fs.get()), _fs.get(), logProvider, EmptyVersionContextSupplier.EMPTY);

            using (NeoStores stores = storeFactory.OpenNeoStores(true, StoreType.RELATIONSHIP_GROUP))
            {
                RecordStore <RelationshipGroupRecord> store = spy(stores.RelationshipGroupStore);

                RelationshipGroupRecord group2  = Group(0, 2);
                RelationshipGroupRecord group4  = Group(1, 4);
                RelationshipGroupRecord group10 = Group(2, 10);
                RelationshipGroupRecord group23 = Group(3, 23);
                Link(group2, group4, group10, group23);
                store.UpdateRecord(group2);
                store.UpdateRecord(group4);
                store.UpdateRecord(group10);
                store.UpdateRecord(group23);
                RelationshipGroupGetter groupGetter = new RelationshipGroupGetter(store);
                NodeRecord node = new NodeRecord(0, true, group2.Id, -1);

                // WHEN trying to find relationship group 7
                RecordAccess <RelationshipGroupRecord, int>       access = new DirectRecordAccess <RelationshipGroupRecord, int>(store, Loaders.relationshipGroupLoader(store));
                RelationshipGroupGetter.RelationshipGroupPosition result = groupGetter.GetRelationshipGroup(node, 7, access);

                // THEN only groups 2, 4 and 10 should have been loaded
                InOrder verification = inOrder(store);
                verification.verify(store).getRecord(eq(group2.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad)));
                verification.verify(store).getRecord(eq(group4.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad)));
                verification.verify(store).getRecord(eq(group10.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad)));
                verification.verify(store, never()).getRecord(eq(group23.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad)));

                // it should also be reported as not found
                assertNull(result.Group());
                // with group 4 as closes previous one
                assertEquals(group4, result.ClosestPrevious().forReadingData());
            }
        }