//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))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void schemaCacheSnapshotsShouldBeReadOnly() public virtual void SchemaCacheSnapshotsShouldBeReadOnly() { // Given SchemaCache cache = NewSchemaCache(); cache.AddSchemaRule(NewIndexRule(1L, 1, 2)); cache.AddSchemaRule(NewIndexRule(2L, 2, 3)); SchemaCache snapshot = cache.Snapshot(); cache.AddSchemaRule(NewIndexRule(3L, 1, 2)); // When ISet <CapableIndexDescriptor> indexes = asSet(snapshot.IndexDescriptorsForLabel(1)); // Then ISet <StoreIndexDescriptor> expected = asSet(NewIndexRule(1L, 1, 2)); assertEquals(expected, indexes); try { snapshot.AddSchemaRule(NewIndexRule(3L, 1, 2)); fail("SchemaCache snapshots should not permit mutation."); } catch (System.InvalidOperationException) { // Good. } }
//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))); } }