//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindNodesByLabelInTx() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindNodesByLabelInTx()
        {
            long inStore;
            long deletedInTx;
            long createdInTx;

            using (Transaction tx = beginTransaction())
            {
                inStore = CreateNode(tx.DataWrite(), _labelOne);
                CreateNode(tx.DataWrite(), _labelTwo);
                deletedInTx = CreateNode(tx.DataWrite(), _labelOne);
                tx.Success();
            }

            using (Transaction tx = beginTransaction())
            {
                tx.DataWrite().nodeDelete(deletedInTx);
                createdInTx = CreateNode(tx.DataWrite(), _labelOne);

                CreateNode(tx.DataWrite(), _labelTwo);

                Read read = tx.DataRead();

                using (NodeLabelIndexCursor cursor = tx.Cursors().allocateNodeLabelIndexCursor())
                {
                    MutableLongSet uniqueIds = new LongHashSet();

                    // when
                    read.NodeLabelScan(_labelOne, cursor);

                    // then
                    assertNodes(cursor, uniqueIds, inStore, createdInTx);
                }
            }
        }
Exemplo n.º 2
0
        public override NodeLabelIndexCursor AllocateNodeLabelIndexCursor()
        {
            NodeLabelIndexCursor n = _cursors.allocateNodeLabelIndexCursor();

            _allCursors.Add(n);
            return(n);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindNodesByLabel() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindNodesByLabel()
        {
            // GIVEN
            long toDelete;

            using (Transaction tx = beginTransaction())
            {
                CreateNode(tx.DataWrite(), _labelOne, _labelFirst);
                CreateNode(tx.DataWrite(), _labelTwo, _labelFirst);
                CreateNode(tx.DataWrite(), _labelThree, _labelFirst);
                toDelete = CreateNode(tx.DataWrite(), _labelOne);
                CreateNode(tx.DataWrite(), _labelTwo);
                CreateNode(tx.DataWrite(), _labelThree);
                CreateNode(tx.DataWrite(), _labelThree);
                tx.Success();
            }

            using (Transaction tx = beginTransaction())
            {
                tx.DataWrite().nodeDelete(toDelete);
                tx.Success();
            }

            using (Transaction tx = beginTransaction())
            {
                Read read = tx.DataRead();

                using (NodeLabelIndexCursor cursor = tx.Cursors().allocateNodeLabelIndexCursor())
                {
                    MutableLongSet uniqueIds = new LongHashSet();

                    // WHEN
                    read.NodeLabelScan(_labelOne, cursor);

                    // THEN
                    assertNodeCount(cursor, 1, uniqueIds);

                    // WHEN
                    read.NodeLabelScan(_labelTwo, cursor);

                    // THEN
                    assertNodeCount(cursor, 2, uniqueIds);

                    // WHEN
                    read.NodeLabelScan(_labelThree, cursor);

                    // THEN
                    assertNodeCount(cursor, 3, uniqueIds);

                    // WHEN
                    uniqueIds.clear();
                    read.NodeLabelScan(_labelFirst, cursor);

                    // THEN
                    assertNodeCount(cursor, 3, uniqueIds);
                }
            }
        }
Exemplo n.º 4
0
        public override void NodeLabelIntersectionScan(NodeLabelIndexCursor cursor, params int[] labels)
        {
            Ktx.assertOpen();

            DefaultNodeLabelIndexCursor client = ( DefaultNodeLabelIndexCursor )cursor;

            client.Read = this;
            client.IntersectionScan(new NodeLabelIndexProgressor(LabelScanReader().nodesWithAllLabels(labels), client), false, labels);
        }
Exemplo n.º 5
0
        public override void NodeLabelScan(int label, NodeLabelIndexCursor cursor)
        {
            Ktx.assertOpen();

            DefaultNodeLabelIndexCursor indexCursor = ( DefaultNodeLabelIndexCursor )cursor;

            indexCursor.Read = this;
            LabelScanReader().nodesWithLabel(indexCursor, label);
        }
Exemplo n.º 6
0
 public override void NodeLabelIntersectionScan(NodeLabelIndexCursor cursor, params int[] labels)
 {
     throw new System.NotSupportedException();
 }
Exemplo n.º 7
0
 public override void NodeLabelScan(int label, NodeLabelIndexCursor cursor)
 {
     (( StubNodeLabelIndexCursor )cursor).Initialize(label);
 }