Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAccessNodes()
        public virtual void ShouldAccessNodes()
        {
            // given
            using (RelationshipScanCursor relationships = cursors.allocateRelationshipScanCursor())
            {
                // when
                read.singleRelationship(_one, relationships);

                // then
                assertTrue(relationships.Next());
                assertEquals(_c, relationships.SourceNodeReference());
                assertEquals(_d, relationships.TargetNodeReference());
                assertFalse(relationships.Next());

                // when
                read.singleRelationship(_loop, relationships);

                // then
                assertTrue(relationships.Next());
                assertEquals(relationships.SourceNodeReference(), relationships.TargetNodeReference());
                assertFalse(relationships.Next());
            }
        }
Ejemplo n.º 2
0
 public virtual bool InitializeData()
 {
     // It enough to check only start node, since it's absence will indicate that data was not yet loaded.
     if (_startNode == AbstractBaseRecord.NO_ID)
     {
         KernelTransaction transaction = _spi.kernelTransaction();
         using (Statement ignore = transaction.AcquireStatement())
         {
             RelationshipScanCursor relationships = transaction.AmbientRelationshipCursor();
             transaction.DataRead().singleRelationship(_id, relationships);
             // At this point we don't care if it is there or not just load what we got.
             bool wasPresent = relationships.Next();
             this._type      = relationships.Type();
             this._startNode = relationships.SourceNodeReference();
             this._endNode   = relationships.TargetNodeReference();
             // But others might care, e.g. the Bolt server needs to know for serialisation purposes.
             return(wasPresent);
         }
     }
     return(true);
 }