//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLoadAllConnectedRelationshipRecordsAndTheirFullChainsOfRelationshipRecords()
        public virtual void ShouldLoadAllConnectedRelationshipRecordsAndTheirFullChainsOfRelationshipRecords()
        {
            // given
            RecordStore <RelationshipRecord> relationshipStore = _store.RelationshipStore;

            // when
            int relationshipIdInMiddleOfChain      = 10;
            RecordSet <RelationshipRecord> records = (new RelationshipChainExplorer(relationshipStore)).ExploreRelationshipRecordChainsToDepthTwo(relationshipStore.GetRecord(relationshipIdInMiddleOfChain, relationshipStore.NewRecord(), NORMAL));

            // then
            assertEquals(DEGREE_TWO_NODES * 2, records.Size());
        }
        public virtual RecordSet <RelationshipRecord> FindRelationshipChainsThatThisRecordShouldBelongTo(RelationshipRecord relationship)
        {
            RecordSet <RelationshipRecord> records = new RecordSet <RelationshipRecord>();

            foreach (RelationshipNodeField field in RelationshipNodeField.values())
            {
                long nodeId = field.get(relationship);
                _nodeStore.getRecord(nodeId, _nodeRecord, RecordLoad.FORCE);
                records.AddAll(_relationshipChainExplorer.followChainFromNode(nodeId, _nodeRecord.NextRel));
            }
            return(records);
        }
        private RecordSet <RelationshipRecord> ExpandChain(RelationshipRecord record, long nodeId, RelationshipChainDirection direction)
        {
            RecordSet <RelationshipRecord> chain = new RecordSet <RelationshipRecord>();

            chain.Add(record);
            RelationshipRecord currentRecord = record;
            long nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);

            while (currentRecord.InUse() && !direction.fieldFor(nodeId, currentRecord).endOfChain(currentRecord))
            {
                currentRecord = _recordStore.getRecord(nextRelId, _recordStore.newRecord(), FORCE);
                chain.Add(currentRecord);
                nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);
            }
            return(chain);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCopeWithAChainThatReferencesNotInUseZeroValueRecords()
        public virtual void ShouldCopeWithAChainThatReferencesNotInUseZeroValueRecords()
        {
            // given
            RecordStore <RelationshipRecord> relationshipStore = _store.RelationshipStore;

            BreakTheChain(relationshipStore);

            // when
            int relationshipIdInMiddleOfChain      = 10;
            RecordSet <RelationshipRecord> records = (new RelationshipChainExplorer(relationshipStore)).ExploreRelationshipRecordChainsToDepthTwo(relationshipStore.GetRecord(relationshipIdInMiddleOfChain, relationshipStore.NewRecord(), NORMAL));

            // then
            int recordsInaccessibleBecauseOfBrokenChain = 3;

            assertEquals(DEGREE_TWO_NODES * 2 - recordsInaccessibleBecauseOfBrokenChain, records.Size());
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void toStringShouldPlaceEachRecordOnItsOwnLine()
        internal virtual void ToStringShouldPlaceEachRecordOnItsOwnLine()
        {
            // given
            NodeRecord             record1 = new NodeRecord(1, false, 1, 1);
            NodeRecord             record2 = new NodeRecord(2, false, 2, 2);
            RecordSet <NodeRecord> set     = new RecordSet <NodeRecord>();

            set.Add(record1);
            set.Add(record2);

            // when
            string @string = set.ToString();

            // then
            string[] lines = @string.Split("\n", true);
            assertEquals(4, lines.Length);
            assertEquals("[", lines[0]);
            assertEquals(record1.ToString() + ",", lines[1]);
            assertEquals(record2.ToString() + ",", lines[2]);
            assertEquals("]", lines[3]);
        }
Beispiel #6
0
        public virtual bool ContainsAll(RecordSet <R> other)
        {
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'containsAll' method:
            return(_map.Keys.containsAll(other._map.Keys));
        }
Beispiel #7
0
 public virtual void AddAll(RecordSet <R> other)
 {
     _map.putAll(other._map);
 }