Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void forceGetRecordSkipInUsecheck() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ForceGetRecordSkipInUsecheck()
        {
            LabelTokenStore  store  = new UnusedLabelTokenStore(this);
            LabelTokenRecord record = store.getRecord(7, store.newRecord(), FORCE);

            assertFalse("Record should not be in use", record.InUse());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportInvalidLabelReferences() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldReportInvalidLabelReferences()
        {
            // given
            int schemaRuleId = 0;

            DynamicRecord           record             = InUse(DynamicRecord(schemaRuleId));
            IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("in-memory", "1.0");
            StoreIndexDescriptor    rule = indexRule(schemaRuleId, _labelId, _propertyKeyId, providerDescriptor);

            when(Checker().ruleAccess.loadSingleSchemaRule(schemaRuleId)).thenReturn(rule);

            LabelTokenRecord labelTokenRecord = Add(NotInUse(new LabelTokenRecord(_labelId)));

            Add(InUse(new PropertyKeyTokenRecord(_propertyKeyId)));

            // when
            Org.Neo4j.Consistency.report.ConsistencyReport_SchemaConsistencyReport report = Check(record);

            // then
            verify(report).labelNotInUse(labelTokenRecord);
        }