//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindDecentAmountOfNodesForALabel() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindDecentAmountOfNodesForALabel()
        {
            // GIVEN
            // 16 is the magic number of the page iterator
            // 32 is the number of nodes in each lucene document
            const int labelId   = 1;
            int       nodeCount = 32 * 16 + 10;

            Start();
            Write(new PrefetchingIteratorAnonymousInnerClass(this, labelId, nodeCount));

            // WHEN
            ISet <long>     nodeSet = new SortedSet <long>();
            LabelScanReader reader  = _store.newReader();
            LongIterator    nodes   = reader.NodesWithLabel(labelId);

            while (nodes.hasNext())
            {
                nodeSet.Add(nodes.next());
            }
            reader.Close();

            // THEN
            assertEquals("Found gaps in node id range: " + Gaps(nodeSet, nodeCount), nodeCount, nodeSet.Count);
        }
 private long[] ReadNodesForLabel(LabelScanStore labelScanStore)
 {
     using (LabelScanReader reader = labelScanStore.NewReader())
     {
         return(PrimitiveLongCollections.asArray(reader.NodesWithLabel(_labelId)));
     }
 }
Exemple #3
0
 private void VerifyReads(long[] expected)
 {
     using (LabelScanReader reader = _store.newReader())
     {
         for (int i = 0; i < LABEL_COUNT; i++)
         {
             long[] actualNodes   = asArray(reader.NodesWithLabel(i));
             long[] expectedNodes = NodesWithLabel(expected, i);
             assertArrayEquals(expectedNodes, actualNodes);
         }
     }
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void checkLabelScanStoreAccessible(org.neo4j.kernel.api.labelscan.LabelScanStore labelScanStore) throws java.io.IOException
        private static void CheckLabelScanStoreAccessible(LabelScanStore labelScanStore)
        {
            int labelId = 1;

            using (LabelScanWriter labelScanWriter = labelScanStore.NewWriter())
            {
                labelScanWriter.Write(NodeLabelUpdate.labelChanges(1, new long[] {}, new long[] { labelId }));
            }
            using (LabelScanReader labelScanReader = labelScanStore.NewReader())
            {
                assertEquals(1, labelScanReader.NodesWithLabel(labelId).next());
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWorkWithAFullRange()
        public virtual void ShouldWorkWithAFullRange()
        {
            // given
            long labelId = 0;
            IList <NodeLabelUpdate> updates = new List <NodeLabelUpdate>();
            ISet <long>             nodes   = new HashSet <long>();

            for (int i = 0; i < 34; i++)
            {
                updates.Add(NodeLabelUpdate.labelChanges(i, new long[] {}, new long[] { labelId }));
                nodes.Add(( long )i);
            }

            Start(updates);

            // when
            LabelScanReader reader         = _store.newReader();
            ISet <long>     nodesWithLabel = PrimitiveLongCollections.toSet(reader.NodesWithLabel(( int )labelId));

            // then
            assertEquals(nodes, nodesWithLabel);
        }