Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void addRemoveIndexes()
        public virtual void AddRemoveIndexes()
        {
            ICollection <SchemaRule> rules = asList(_hans, _witch, _gretel, _robot);
            SchemaCache cache = new SchemaCache(new ConstraintSemantics(), rules, IndexProviderMap.EMPTY);

            StoreIndexDescriptor rule1 = NewIndexRule(10, 11, 12);
            StoreIndexDescriptor rule2 = NewIndexRule(13, 14, 15);

            cache.AddSchemaRule(rule1);
            cache.AddSchemaRule(rule2);

            cache.RemoveSchemaRule(_hans.Id);
            cache.RemoveSchemaRule(_witch.Id);

            assertEquals(asSet(_gretel, rule1, rule2), Iterables.asSet(cache.IndexDescriptors()));
            assertEquals(asSet(_robot), Iterables.asSet(cache.ConstraintRules()));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removeSchemaWithRepeatedRelType()
        public virtual void RemoveSchemaWithRepeatedRelType()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SchemaCache cache = newSchemaCache();
            SchemaCache cache = NewSchemaCache();

            const int id = 1;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int[] repeatedRelTypes = {0, 1, 0};
            int[] repeatedRelTypes = new int[] { 0, 1, 0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.api.schema.MultiTokenSchemaDescriptor schema = org.neo4j.kernel.api.schema.SchemaDescriptorFactory.multiToken(repeatedRelTypes, org.neo4j.storageengine.api.EntityType.RELATIONSHIP, 1);
            MultiTokenSchemaDescriptor schema = SchemaDescriptorFactory.multiToken(repeatedRelTypes, EntityType.RELATIONSHIP, 1);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.schema.StoreIndexDescriptor storeIndexDescriptor = org.neo4j.storageengine.api.schema.IndexDescriptorFactory.forSchema(schema).withId(id);
            StoreIndexDescriptor storeIndexDescriptor = IndexDescriptorFactory.forSchema(schema).withId(id);

            cache.AddSchemaRule(storeIndexDescriptor);
            cache.RemoveSchemaRule(id);
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void should_remove_constraints()
        public virtual void ShouldRemoveConstraints()
        {
            // GIVEN
            SchemaCache cache = NewSchemaCache();

            cache.AddSchemaRule(UniquenessConstraintRule(0L, 1, 2, 133L));
            cache.AddSchemaRule(UniquenessConstraintRule(1L, 3, 4, 133L));

            // WHEN
            cache.RemoveSchemaRule(0L);

            // THEN
            ConstraintDescriptor dropped = uniqueForLabel(1, 1);
            ConstraintDescriptor unique  = uniqueForLabel(3, 4);

            assertEquals(asSet(unique), asSet(cache.Constraints()));

            assertEquals(asSet(), asSet(cache.ConstraintsForLabel(1)));

            assertEquals(asSet(), asSet(cache.ConstraintsForSchema(dropped.Schema())));
        }