示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListAllConstraintsForLabelAndProperty()
        public virtual void ShouldListAllConstraintsForLabelAndProperty()
        {
            // Given
            CreateUniquenessConstraint(Label1, PropertyKey);
            CreateUniquenessConstraint(Label1, OtherPropertyKey);

            // When
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForSchema(UniqueConstraintDescriptor(Label1, PropertyKey).schema()));

            // Then
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Set<?> expectedConstraints = asSet(uniqueConstraintDescriptor(label1, propertyKey));
            ISet <object> expectedConstraints = asSet(UniqueConstraintDescriptor(Label1, PropertyKey));

            assertEquals(expectedConstraints, constraints);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListAllConstraintsForRelationshipTypeAndProperty()
        public virtual void ShouldListAllConstraintsForRelationshipTypeAndProperty()
        {
            // Given
            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey);
            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, OtherPropertyKey);

            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, PropertyKey);
            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, OtherPropertyKey);

            // When
            int relTypeId = RelationshipTypeId(RelType1);
            int propKeyId = PropertyKeyId(PropertyKey);
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForSchema(SchemaDescriptorFactory.forRelType(relTypeId, propKeyId)));

            // Then
            ISet <ConstraintDescriptor> expectedConstraints = Iterators.asSet(RelationshipPropertyExistenceDescriptor(RelType1, PropertyKey));

            assertEquals(expectedConstraints, constraints);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListAllConstraintsForLabelAndProperty()
        public virtual void ShouldListAllConstraintsForLabelAndProperty()
        {
            // Given
            SchemaHelper.createUniquenessConstraint(Db, Label2, PropertyKey);
            SchemaHelper.createUniquenessConstraint(Db, Label1, OtherPropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label1, PropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label2, OtherPropertyKey);

            SchemaHelper.createNodePropertyExistenceConstraint(Db, Label1, PropertyKey);
            SchemaHelper.createNodePropertyExistenceConstraint(Db, Label2, PropertyKey);

            SchemaHelper.awaitIndexes(Db);

            // When
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForSchema(SchemaDescriptorFactory.forLabel(LabelId(Label1), PropertyKeyId(PropertyKey))));

            // Then
            ISet <ConstraintDescriptor> expected = asSet(NodeKeyConstraintDescriptor(Label1, PropertyKey), NodePropertyExistenceDescriptor(Label1, PropertyKey));

            assertEquals(expected, constraints);
        }