Ejemplo n.º 1
0
        private void AssertCorrectLength(ConstraintRule constraintRule)
        {
            // GIVEN
            ByteBuffer buffer = ByteBuffer.wrap(SchemaRuleSerialization.Serialize(constraintRule));

            // THEN
            assertThat(SchemaRuleSerialization.LengthOf(constraintRule), equalTo(buffer.capacity()));
        }
Ejemplo n.º 2
0
        private void AssertCorrectLength(StoreIndexDescriptor indexRule)
        {
            // GIVEN
            ByteBuffer buffer = ByteBuffer.wrap(SchemaRuleSerialization.Serialize(indexRule));

            // THEN
            assertThat(SchemaRuleSerialization.LengthOf(indexRule), equalTo(buffer.capacity()));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertParseRelationshipPropertyExistsRule(String serialized, String name) throws Exception
        private void AssertParseRelationshipPropertyExistsRule(string serialized, string name)
        {
            // GIVEN
            long ruleId      = 51;
            int  propertyKey = 6119;
            int  relTypeId   = 8512;
            ConstraintDescriptor constraint = ConstraintDescriptorFactory.existsForRelType(relTypeId, propertyKey);

            sbyte[] bytes = DecodeBase64(serialized);

            // WHEN
            ConstraintRule deserialized = AssertConstraintRule(SchemaRuleSerialization.Deserialize(ruleId, ByteBuffer.wrap(bytes)));

            // THEN
            assertThat(deserialized.Id, equalTo(ruleId));
            assertThat(deserialized.ConstraintDescriptor, equalTo(constraint));
            assertThat(deserialized.Schema(), equalTo(constraint.Schema()));
            assertException(deserialized.getOwnedIndex, typeof(System.InvalidOperationException));
            assertThat(deserialized.Name, @is(name));
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertParseIndexRule(String serialized, String name) throws Exception
        private void AssertParseIndexRule(string serialized, string name)
        {
            // GIVEN
            long                    ruleId        = 24;
            IndexDescriptor         index         = ForLabel(512, 4);
            IndexProviderDescriptor indexProvider = new IndexProviderDescriptor("index-provider", "25.0");

            sbyte[] bytes = DecodeBase64(serialized);

            // WHEN
            StoreIndexDescriptor deserialized = AssertIndexRule(SchemaRuleSerialization.Deserialize(ruleId, ByteBuffer.wrap(bytes)));

            // THEN
            assertThat(deserialized.Id, equalTo(ruleId));
            assertThat(deserialized, equalTo(index));
            assertThat(deserialized.Schema(), equalTo(index.Schema()));
            assertThat(deserialized.ProviderDescriptor(), equalTo(indexProvider));
            assertThat(deserialized.Name, @is(name));
            assertException(deserialized.getOwningConstraint, typeof(System.InvalidOperationException));
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertParseNodeKeyConstraintRule(String serialized, String name) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        private void AssertParseNodeKeyConstraintRule(string serialized, string name)
        {
            // GIVEN
            long ruleId       = 1;
            int  propertyKey  = 3;
            int  labelId      = 55;
            long ownedIndexId = 2;
            NodeKeyConstraintDescriptor constraint = ConstraintDescriptorFactory.nodeKeyForLabel(labelId, propertyKey);

            sbyte[] bytes = DecodeBase64(serialized);

            // WHEN
            ConstraintRule deserialized = AssertConstraintRule(SchemaRuleSerialization.Deserialize(ruleId, ByteBuffer.wrap(bytes)));

            // THEN
            assertThat(deserialized.Id, equalTo(ruleId));
            assertThat(deserialized.ConstraintDescriptor, equalTo(constraint));
            assertThat(deserialized.Schema(), equalTo(constraint.Schema()));
            assertThat(deserialized.OwnedIndex, equalTo(ownedIndexId));
            assertThat(deserialized.Name, @is(name));
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertParseUniqueIndexRule(String serialized, String name) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        private void AssertParseUniqueIndexRule(string serialized, string name)
        {
            // GIVEN
            long                    ruleId        = 33;
            long                    constraintId  = 11;
            IndexDescriptor         index         = TestIndexDescriptorFactory.uniqueForLabel(61, 988);
            IndexProviderDescriptor indexProvider = new IndexProviderDescriptor("index-provider", "25.0");

            sbyte[] bytes = DecodeBase64(serialized);

            // WHEN
            StoreIndexDescriptor deserialized = AssertIndexRule(SchemaRuleSerialization.Deserialize(ruleId, ByteBuffer.wrap(bytes)));

            // THEN
            assertThat(deserialized.Id, equalTo(ruleId));
            assertThat(deserialized, equalTo(index));
            assertThat(deserialized.Schema(), equalTo(index.Schema()));
            assertThat(deserialized.ProviderDescriptor(), equalTo(indexProvider));
            assertThat(deserialized.OwningConstraint, equalTo(constraintId));
            assertThat(deserialized.Name, @is(name));
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.storageengine.api.schema.SchemaRule serialiseAndDeserialise(org.neo4j.storageengine.api.schema.StoreIndexDescriptor indexRule) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        private SchemaRule SerialiseAndDeserialise(StoreIndexDescriptor indexRule)
        {
            ByteBuffer buffer = ByteBuffer.wrap(SchemaRuleSerialization.Serialize(indexRule));

            return(SchemaRuleSerialization.Deserialize(indexRule.Id, buffer));
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.storageengine.api.schema.SchemaRule serialiseAndDeserialise(ConstraintRule constraintRule) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        private SchemaRule SerialiseAndDeserialise(ConstraintRule constraintRule)
        {
            ByteBuffer buffer = ByteBuffer.wrap(SchemaRuleSerialization.Serialize(constraintRule));

            return(SchemaRuleSerialization.Deserialize(constraintRule.Id, buffer));
        }