Ejemplo n.º 1
0
 internal LabelScanViewIdIterator(LabelScanReader labelScanReader, int[] labelIds, CURSOR entityCursor)
 {
     this._labelScanReader = labelScanReader;
     this._entityCursor    = entityCursor;
     this._idIterator      = labelScanReader.NodesWithAnyOfLabels(labelIds);
     this._labelIds        = labelIds;
 }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseOpenedLabelScanReader()
        public virtual void ShouldCloseOpenedLabelScanReader()
        {
            // given
            System.Func <LabelScanReader> scanStore = mock(typeof(System.Func));
            LabelScanReader scanReader = mock(typeof(LabelScanReader));

            when(scanStore()).thenReturn(scanReader);
            RecordStorageReader statement = new RecordStorageReader(null, null, MockedNeoStores.basicMockedNeoStores(), null, null, mock(typeof(System.Func)), scanStore, mock(typeof(RecordStorageCommandCreationContext)));

            statement.Acquire();

            // when
            LabelScanReader actualReader = statement.LabelScanReader;

            // then
            assertEquals(scanReader, actualReader);

            // when
            statement.Close();

            // then
            verify(scanStore).get();
            verifyNoMoreInteractions(scanStore);

            verify(scanReader).close();
            verifyNoMoreInteractions(scanReader);
        }
Ejemplo n.º 3
0
 private void AssertNoContentInNativeLabelScanStore(DatabaseLayout databaseLayout)
 {
     using (Lifespan lifespan = new Lifespan())
     {
         NativeLabelScanStore nativeLabelScanStore = GetNativeLabelScanStore(databaseLayout, true);
         lifespan.Add(nativeLabelScanStore);
         using (LabelScanReader labelScanReader = nativeLabelScanStore.NewReader())
         {
             int count = PrimitiveLongCollections.count(labelScanReader.NodesWithLabel(1));
             assertEquals(0, count);
         }
     }
 }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populateNativeLabelScanIndexDuringMigration() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulateNativeLabelScanIndexDuringMigration()
        {
            Prepare34DatabaseWithNodes();
            _indexMigrator.migrate(_databaseLayout, _migrationLayout, _progressReporter, StandardV3_4.STORE_VERSION, StandardV3_4.STORE_VERSION);
            _indexMigrator.moveMigratedFiles(_migrationLayout, _databaseLayout, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION);

            using (Lifespan lifespan = new Lifespan())
            {
                NativeLabelScanStore labelScanStore = GetNativeLabelScanStore(_databaseLayout, true);
                lifespan.Add(labelScanStore);
                for (int labelId = 0; labelId < 10; labelId++)
                {
                    using (LabelScanReader labelScanReader = labelScanStore.NewReader())
                    {
                        int nodeCount = PrimitiveLongCollections.count(labelScanReader.NodesWithLabel(labelId));
                        assertEquals(format("Expected to see only one node for label %d but was %d.", labelId, nodeCount), 1, nodeCount);
                    }
                }
            }
        }