コード例 #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
ファイル: PropertyStoreTest.cs プロジェクト: Neo4Net/Neo4Net
        private PropertyBlock PropertyBlockWith(DynamicRecord dynamicRecord)
        {
            PropertyBlock propertyBlock = new PropertyBlock();

            PropertyKeyTokenRecord key = new PropertyKeyTokenRecord(10);

            propertyBlock.SingleBlock = key.Id | ((( long )PropertyType.String.intValue()) << 24) | (dynamicRecord.Id << 28);
            propertyBlock.AddValueRecord(dynamicRecord);

            return(propertyBlock);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportPropertyKeyNotInUse()
        internal virtual void ShouldReportPropertyKeyNotInUse()
        {
            // given
            PropertyRecord         property = InUse(new PropertyRecord(42));
            PropertyKeyTokenRecord key      = Add(NotInUse(new PropertyKeyTokenRecord(0)));
            PropertyBlock          block    = PropertyBlock(key, PropertyType.INT, 0);

            property.AddPropertyBlock(block);

            // when
            Org.Neo4j.Consistency.report.ConsistencyReport_PropertyConsistencyReport report = Check(property);

            // then
            verify(report).keyNotInUse(block, key);
            verifyNoMoreInteractions(report);
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportStringRecordNotInUse()
        internal virtual void ShouldReportStringRecordNotInUse()
        {
            // given
            PropertyRecord         property = InUse(new PropertyRecord(42));
            PropertyKeyTokenRecord key      = Add(InUse(new PropertyKeyTokenRecord(6)));
            DynamicRecord          value    = Add(NotInUse(String(new DynamicRecord(1001))));
            PropertyBlock          block    = PropertyBlock(key, value);

            property.AddPropertyBlock(block);

            // when
            Org.Neo4j.Consistency.report.ConsistencyReport_PropertyConsistencyReport report = Check(property);
            // then
            verify(report).stringNotInUse(block, value);
            verifyNoMoreInteractions(report);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportInvalidPropertyReferenceFromIndexRule() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldReportInvalidPropertyReferenceFromIndexRule()
        {
            // 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);

            Add(InUse(new LabelTokenRecord(_labelId)));
            PropertyKeyTokenRecord propertyKeyToken = Add(NotInUse(new PropertyKeyTokenRecord(_propertyKeyId)));

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

            // then
            verify(report).propertyKeyNotInUse(propertyKeyToken);
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportInvalidPropertyReferenceFromUniquenessConstraintRule() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldReportInvalidPropertyReferenceFromUniquenessConstraintRule()
        {
            // given
            int schemaRuleId = 0;
            int indexRuleId  = 1;

            DynamicRecord record = InUse(DynamicRecord(schemaRuleId));

            ConstraintRule rule = uniquenessConstraintRule(schemaRuleId, _labelId, _propertyKeyId, indexRuleId);

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

            Add(InUse(new LabelTokenRecord(_labelId)));
            PropertyKeyTokenRecord propertyKeyToken = Add(NotInUse(new PropertyKeyTokenRecord(_propertyKeyId)));

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

            // then
            verify(report).propertyKeyNotInUse(propertyKeyToken);
        }