예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAddAndReadMultipleKeys() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldAddAndReadMultipleKeys()
        {
            IList <GenericKey> keys = new List <GenericKey>();
            int numberOfKeys        = 1000;

            for (int i = 0; i < numberOfKeys; i++)
            {
                keys.Add(RandomKey(i));
            }
            using (IndexKeyStorage <GenericKey> keyStorage = keyStorage())
            {
                foreach (GenericKey key in keys)
                {
                    keyStorage.add(key);
                }
                keyStorage.doneAdding();
                using (IndexKeyStorage.KeyEntryCursor <GenericKey> reader = keyStorage.reader())
                {
                    foreach (GenericKey expected in keys)
                    {
                        assertTrue(reader.Next());
                        GenericKey actual = reader.Key();
                        assertEquals(0, _layout.compare(expected, actual), "Expected stored key to be equal to original.");
                    }
                    assertFalse(reader.Next(), "Expected reader to have no more entries, but had at least one additional " + reader.Key());
                }
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyUniqueKeys(IndexKeyStorage.KeyEntryCursor<KEY> allConflictingKeys) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private void VerifyUniqueKeys(IndexKeyStorage.KeyEntryCursor <KEY> allConflictingKeys)
        {
            while (allConflictingKeys.Next() && !_cancellation.cancelled())
            {
                KEY key = allConflictingKeys.Key();
                key.CompareId = false;
                VerifyUniqueSeek(tree.seek(key, key));
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAddAndReadOneKey() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldAddAndReadOneKey()
        {
            using (IndexKeyStorage <GenericKey> keyStorage = keyStorage())
            {
                GenericKey expected = RandomKey(1);
                keyStorage.add(expected);
                keyStorage.doneAdding();
                using (IndexKeyStorage.KeyEntryCursor <GenericKey> reader = keyStorage.reader())
                {
                    assertTrue(reader.Next(), "Expected reader to have one entry");
                    GenericKey actual = reader.Key();
                    assertEquals(0, _layout.compare(expected, actual), "Expected stored key to be equal to original.");
                    assertFalse(reader.Next(), "Expected reader to have only one entry, second entry was " + reader.Key());
                }
            }
        }