コード例 #1
0
ファイル: SchemaCacheTest.cs プロジェクト: Neo4Net/Neo4Net
//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
ファイル: SchemaCacheTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
            }
        }