Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldServePropertyKeysAndRelationshipLabelsFromSuppliedArrayCaches()
        internal virtual void ShouldServePropertyKeysAndRelationshipLabelsFromSuppliedArrayCaches()
        {
            // given
            RecordAccess                @delegate         = mock(typeof(RecordAccess));
            PropertyKeyTokenRecord      propertyKey0      = new PropertyKeyTokenRecord(0);
            PropertyKeyTokenRecord      propertyKey2      = new PropertyKeyTokenRecord(2);
            PropertyKeyTokenRecord      propertyKey1      = new PropertyKeyTokenRecord(1);
            RelationshipTypeTokenRecord relationshipType0 = new RelationshipTypeTokenRecord(0);
            RelationshipTypeTokenRecord relationshipType1 = new RelationshipTypeTokenRecord(1);
            RelationshipTypeTokenRecord relationshipType2 = new RelationshipTypeTokenRecord(2);
            LabelTokenRecord            label0            = new LabelTokenRecord(0);
            LabelTokenRecord            label1            = new LabelTokenRecord(1);
            LabelTokenRecord            label2            = new LabelTokenRecord(2);

            CacheSmallStoresRecordAccess recordAccess = new CacheSmallStoresRecordAccess(@delegate, new PropertyKeyTokenRecord[] { propertyKey0, propertyKey1, propertyKey2 }, new RelationshipTypeTokenRecord[] { relationshipType0, relationshipType1, relationshipType2 }, new LabelTokenRecord[] { label0, label1, label2 });

            // when
            assertThat(recordAccess.PropertyKey(0), IsDirectReferenceTo(propertyKey0));
            assertThat(recordAccess.PropertyKey(1), IsDirectReferenceTo(propertyKey1));
            assertThat(recordAccess.PropertyKey(2), IsDirectReferenceTo(propertyKey2));
            assertThat(recordAccess.RelationshipType(0), IsDirectReferenceTo(relationshipType0));
            assertThat(recordAccess.RelationshipType(1), IsDirectReferenceTo(relationshipType1));
            assertThat(recordAccess.RelationshipType(2), IsDirectReferenceTo(relationshipType2));
            assertThat(recordAccess.Label(0), IsDirectReferenceTo(label0));
            assertThat(recordAccess.Label(1), IsDirectReferenceTo(label1));
            assertThat(recordAccess.Label(2), IsDirectReferenceTo(label2));

            // then
            verifyZeroInteractions(@delegate);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleRelationshipTypesBeyond2Bytes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleRelationshipTypesBeyond2Bytes()
        {
            // given
            RecordFormat <RelationshipTypeTokenRecord> format = HighLimit.RecordFormats.relationshipTypeToken();
            int typeId = 1 << ((sizeof(short) * 8) + (sizeof(sbyte) * 8)) - 1;
            RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord(typeId);
            int recordSize = format.GetRecordSize(NO_STORE_HEADER);

            record.Initialize(true, 10);
            IdSequence doubleUnits = mock(typeof(IdSequence));
            PageCursor cursor      = new StubPageCursor(0, ( int )kibiBytes(8));

            // when
            format.Prepare(record, recordSize, doubleUnits);
            format.Write(record, cursor, recordSize);
            verifyNoMoreInteractions(doubleUnits);

            // then
            RelationshipTypeTokenRecord read = new RelationshipTypeTokenRecord(typeId);

            format.Read(record, cursor, NORMAL, recordSize);
            assertEquals(record, read);
        }
Пример #3
0
 public void CheckReference(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord record, Org.Neo4j.Kernel.impl.store.record.RelationshipTypeTokenRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records)
 {
     if (!referred.InUse())
     {
         engine.Report().relationshipTypeNotInUse(referred);
     }
 }