示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMakeEntryConflicts()
        public virtual void ShouldMakeEntryConflicts()
        {
            LabelSchemaDescriptor       schema = SchemaDescriptorFactory.forLabel(LABEL_ID, 2);
            IndexEntryConflictException e      = new IndexEntryConflictException(0L, 1L, Value);

            assertThat(e.EvidenceMessage(SchemaUtil.idTokenNameLookup, schema), equalTo("Both Node(0) and Node(1) have the label `label[1]` and property `property[2]` = 'hi'"));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMakeEntryConflictsForOneNode()
        public virtual void ShouldMakeEntryConflictsForOneNode()
        {
            LabelSchemaDescriptor       schema = SchemaDescriptorFactory.forLabel(LABEL_ID, 2);
            IndexEntryConflictException e      = new IndexEntryConflictException(0L, StatementConstants.NO_SUCH_NODE, Value);

            assertThat(e.EvidenceMessage(SchemaUtil.idTokenNameLookup, schema), equalTo("Node(0) already exists with label `label[1]` and property `property[2]` = 'hi'"));
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMakeCompositeEntryConflicts()
        public virtual void ShouldMakeCompositeEntryConflicts()
        {
            LabelSchemaDescriptor       schema = SchemaDescriptorFactory.forLabel(LABEL_ID, 2, 3, 4);
            ValueTuple                  values = ValueTuple.of(true, "hi", new long[] { 6L, 4L });
            IndexEntryConflictException e      = new IndexEntryConflictException(0L, 1L, values);

            assertThat(e.EvidenceMessage(SchemaUtil.idTokenNameLookup, schema), equalTo("Both Node(0) and Node(1) have the label `label[1]` " + "and properties `property[2]` = true, `property[3]` = 'hi', `property[4]` = [6, 4]"));
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.internal.kernel.api.IndexReference createIndex(org.neo4j.internal.kernel.api.Transaction transaction) throws org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException, org.neo4j.internal.kernel.api.exceptions.InvalidTransactionTypeKernelException
        private IndexReference CreateIndex([email protected] transaction)
        {
            TokenWrite            tokenWrite       = transaction.TokenWrite();
            SchemaWrite           schemaWrite      = transaction.SchemaWrite();
            LabelSchemaDescriptor schemaDescriptor = forLabel(tokenWrite.LabelGetOrCreateForName("hello"), tokenWrite.PropertyKeyGetOrCreateForName("hepp"));

            return(schemaWrite.IndexCreate(schemaDescriptor));
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBePossibleToCreateConstraintWithDuplicateProperties() throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotBePossibleToCreateConstraintWithDuplicateProperties()
        {
            // given
            SchemaWrite schemaWrite = SchemaWriteInNewTransaction();

            // when
            try
            {
                LabelSchemaDescriptor descriptor = forLabel(0, 1, 1);
                schemaWrite.UniquePropertyConstraintCreate(descriptor);
                fail("Should have failed");
            }
            catch (RepeatedPropertyInSchemaException)
            {
                // then good
            }
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void shouldCreateWithSpecificExistingProviderName(IndexCreator creator) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        internal virtual void ShouldCreateWithSpecificExistingProviderName(IndexCreator creator)
        {
            int labelId = 0;

            foreach (GraphDatabaseSettings.SchemaIndex indexSetting in GraphDatabaseSettings.SchemaIndex.values())
            {
                // given
                SchemaWrite           schemaWrite = SchemaWriteInNewTransaction();
                string                provider    = indexSetting.providerName();
                LabelSchemaDescriptor descriptor  = forLabel(labelId++, 0);
                creator.Create(schemaWrite, descriptor, provider);

                // when
                Commit();

                // then
                assertEquals(provider, IndexingService.getIndexProxy(descriptor).Descriptor.providerDescriptor().name());
            }
        }
示例#7
0
 internal IndexBackedConstraintDescriptor(Org.Neo4j.@internal.Kernel.Api.schema.constraints.ConstraintDescriptor_Type type, LabelSchemaDescriptor schema) : base(type)
 {
     this._schema = schema;
 }
 internal NodeKeyConstraintDescriptor(LabelSchemaDescriptor schema) : base(org.neo4j.@internal.kernel.api.schema.constraints.ConstraintDescriptor_Type.UniqueExists, schema)
 {
 }
 internal NodeExistenceConstraintDescriptor(LabelSchemaDescriptor schema) : base(org.neo4j.@internal.kernel.api.schema.constraints.ConstraintDescriptor_Type.Exists)
 {
     this._schema = schema;
 }
示例#10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public abstract void validateNodePropertyExistenceConstraint(org.neo4j.internal.kernel.api.NodeLabelIndexCursor allNodes, org.neo4j.internal.kernel.api.NodeCursor nodeCursor, org.neo4j.internal.kernel.api.PropertyCursor propertyCursor, org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor descriptor) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException;
        public abstract void ValidateNodePropertyExistenceConstraint(NodeLabelIndexCursor allNodes, NodeCursor nodeCursor, PropertyCursor propertyCursor, LabelSchemaDescriptor descriptor);
示例#11
0
 internal UniquenessConstraintDescriptor(LabelSchemaDescriptor schema) : base(org.neo4j.@internal.kernel.api.schema.constraints.ConstraintDescriptor_Type.Unique, schema)
 {
 }
示例#12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void validateNodePropertyExistenceConstraint(org.neo4j.internal.kernel.api.NodeLabelIndexCursor allNodes, org.neo4j.internal.kernel.api.NodeCursor nodeCursor, org.neo4j.internal.kernel.api.PropertyCursor propertyCursor, org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor descriptor) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException
        public override void ValidateNodePropertyExistenceConstraint(NodeLabelIndexCursor allNodes, NodeCursor nodeCursor, PropertyCursor propertyCursor, LabelSchemaDescriptor descriptor)
        {
            throw PropertyExistenceConstraintsNotAllowed(descriptor);
        }
 public NodePropertyExistenceException(LabelSchemaDescriptor schema, ConstraintValidationException.Phase phase, long nodeId) : base(ConstraintDescriptorFactory.existsForSchema(schema), phase, format("Node(%d)", nodeId))
 {
     this._schema = schema;
     this._nodeId = nodeId;
 }
示例#14
0
 public void processSpecific([email protected] schema)
 {
     _callHistory.Add("LabelSchemaDescriptor");
 }
示例#15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void validateNodeKeyConstraint(org.neo4j.internal.kernel.api.NodeLabelIndexCursor allNodes, org.neo4j.internal.kernel.api.NodeCursor nodeCursor, org.neo4j.internal.kernel.api.PropertyCursor propertyCursor, org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor descriptor) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException
        public override void ValidateNodeKeyConstraint(NodeLabelIndexCursor allNodes, NodeCursor nodeCursor, PropertyCursor propertyCursor, LabelSchemaDescriptor descriptor)
        {
            ValidateNodePropertyExistenceConstraint(allNodes, nodeCursor, propertyCursor, descriptor);
        }
示例#16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void validateNodePropertyExistenceConstraint(org.neo4j.internal.kernel.api.NodeLabelIndexCursor allNodes, org.neo4j.internal.kernel.api.NodeCursor nodeCursor, org.neo4j.internal.kernel.api.PropertyCursor propertyCursor, org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor descriptor) throws org.neo4j.internal.kernel.api.exceptions.schema.CreateConstraintFailureException
        public override void ValidateNodePropertyExistenceConstraint(NodeLabelIndexCursor allNodes, NodeCursor nodeCursor, PropertyCursor propertyCursor, LabelSchemaDescriptor descriptor)
        {
            while (allNodes.Next())
            {
                allNodes.Node(nodeCursor);
                while (nodeCursor.Next())
                {
                    foreach (int propertyKey in descriptor.PropertyIds)
                    {
                        nodeCursor.Properties(propertyCursor);
                        if (!HasProperty(propertyCursor, propertyKey))
                        {
                            throw CreateConstraintFailure(new NodePropertyExistenceException(descriptor, VERIFICATION, nodeCursor.NodeReference()));
                        }
                    }
                }
            }
        }