Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void concurrentSchemaRuleRemove() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ConcurrentSchemaRuleRemove()
        {
            SchemaCache cache       = NewSchemaCache();
            int         indexNumber = 20;

            for (int i = 0; i < indexNumber; i++)
            {
                cache.AddSchemaRule(NewIndexRule(i, i, i));
            }
            Race race = new Race();
            int  numberOfDeletions = 10;

            for (int i = 0; i < numberOfDeletions; i++)
            {
                int indexId = i;
                race.AddContestant(() => cache.removeSchemaRule(indexId));
            }
            race.Go();

            assertEquals(indexNumber - numberOfDeletions, Iterables.count(cache.IndexDescriptors()));
            for (int labelId = numberOfDeletions; labelId < indexNumber; labelId++)
            {
                assertEquals(1, Iterators.count(cache.IndexDescriptorsForLabel(labelId)));
            }
            for (int propertyId = numberOfDeletions; propertyId < indexNumber; propertyId++)
            {
                assertEquals(1, Iterators.count(cache.IndexesByProperty(propertyId)));
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void should_construct_schema_cache()
        public virtual void ShouldConstructSchemaCache()
        {
            // GIVEN
            ICollection <SchemaRule> rules = asList(_hans, _witch, _gretel, _robot);
            SchemaCache cache = new SchemaCache(new ConstraintSemantics(), rules, IndexProviderMap.EMPTY);

            // THEN
            assertEquals(asSet(_hans, _gretel), Iterables.asSet(cache.IndexDescriptors()));
            assertEquals(asSet(_witch, _robot), Iterables.asSet(cache.ConstraintRules()));
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void addSchemaRules()
        public virtual void AddSchemaRules()
        {
            // GIVEN
            SchemaCache cache = NewSchemaCache();

            // WHEN
            cache.AddSchemaRule(_hans);
            cache.AddSchemaRule(_gretel);
            cache.AddSchemaRule(_witch);
            cache.AddSchemaRule(_robot);

            // THEN
            assertEquals(asSet(_hans, _gretel), Iterables.asSet(cache.IndexDescriptors()));
            assertEquals(asSet(_witch, _robot), Iterables.asSet(cache.ConstraintRules()));
        }
Пример #4
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()));
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void concurrentSchemaRuleAdd() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ConcurrentSchemaRuleAdd()
        {
            SchemaCache cache       = NewSchemaCache();
            Race        race        = new Race();
            int         indexNumber = 10;

            for (int i = 0; i < indexNumber; i++)
            {
                int id = i;
                race.AddContestant(() => cache.addSchemaRule(NewIndexRule(id, id, id)));
            }
            race.Go();

            assertEquals(indexNumber, Iterables.count(cache.IndexDescriptors()));
            for (int labelId = 0; labelId < indexNumber; labelId++)
            {
                assertEquals(1, Iterators.count(cache.IndexDescriptorsForLabel(labelId)));
            }
            for (int propertyId = 0; propertyId < indexNumber; propertyId++)
            {
                assertEquals(1, Iterators.count(cache.IndexesByProperty(propertyId)));
            }
        }