//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRelationshipsByTypeAndDirection()
        public virtual void ShouldGetRelationshipsByTypeAndDirection()
        {
            RelationshipChangesForNode changes = new RelationshipChangesForNode(RelationshipChangesForNode.DiffStrategy.Add);

            const int type      = 2;
            const int decoyType = 666;

            changes.AddRelationship(1, type, INCOMING);
            changes.AddRelationship(2, type, OUTGOING);
            changes.AddRelationship(3, type, OUTGOING);
            changes.AddRelationship(4, type, LOOP);
            changes.AddRelationship(5, type, LOOP);
            changes.AddRelationship(6, type, LOOP);

            changes.AddRelationship(10, decoyType, INCOMING);
            changes.AddRelationship(11, decoyType, OUTGOING);
            changes.AddRelationship(12, decoyType, LOOP);

            LongIterator rawIncoming = changes.GetRelationships(RelationshipDirection.INCOMING, type);

            assertThat(PrimitiveLongCollections.asArray(rawIncoming), Ids(1));

            LongIterator rawOutgoing = changes.GetRelationships(RelationshipDirection.OUTGOING, type);

            assertThat(PrimitiveLongCollections.asArray(rawOutgoing), Ids(2, 3));

            LongIterator rawLoops = changes.GetRelationships(RelationshipDirection.LOOP, type);

            assertThat(PrimitiveLongCollections.asArray(rawLoops), Ids(4, 5, 6));
        }
Ejemplo n.º 2
0
 public virtual void AddRelationship(long relId, int typeId, RelationshipDirection direction)
 {
     if (!HasAddedRelationships())
     {
         _relationshipsAdded = new RelationshipChangesForNode(DiffStrategy.ADD);
     }
     _relationshipsAdded.addRelationship(relId, typeId, direction);
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRelationships()
        public virtual void ShouldGetRelationships()
        {
            RelationshipChangesForNode changes = new RelationshipChangesForNode(RelationshipChangesForNode.DiffStrategy.Add);

            const int type = 2;

            changes.AddRelationship(1, type, INCOMING);
            changes.AddRelationship(2, type, OUTGOING);
            changes.AddRelationship(3, type, OUTGOING);
            changes.AddRelationship(4, type, LOOP);
            changes.AddRelationship(5, type, LOOP);
            changes.AddRelationship(6, type, LOOP);

            LongIterator rawRelationships = changes.Relationships;

            assertThat(PrimitiveLongCollections.asArray(rawRelationships), Ids(1, 2, 3, 4, 5, 6));
        }
Ejemplo n.º 4
0
 public virtual void RemoveRelationship(long relId, int typeId, RelationshipDirection direction)
 {
     if (HasAddedRelationships())
     {
         if (_relationshipsAdded.removeRelationship(relId, typeId, direction))
         {
             // This was a rel that was added in this tx, no need to add it to the remove list, instead we just
             // remove it from added relationships.
             return;
         }
     }
     if (!HasRemovedRelationships())
     {
         _relationshipsRemoved = new RelationshipChangesForNode(DiffStrategy.REMOVE);
     }
     _relationshipsRemoved.addRelationship(relId, typeId, direction);
 }