예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyRelationshipData(FulltextIndexProvider provider, long secondRelId) throws Exception
        private void VerifyRelationshipData(FulltextIndexProvider provider, long secondRelId)
        {
            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction   ktx    = LuceneFulltextTestSupport.KernelTransaction(tx);
                ScoreEntityIterator result = provider.Query(ktx, "fulltext", "valuuu");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(0L, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());

                result = provider.Query(ktx, "fulltext", "villa");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(secondRelId, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());

                result = provider.Query(ktx, "fulltext", "value3");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(0L, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(secondRelId, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());
                tx.Success();
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mergeShouldHandleAllEmptyIterators()
        public virtual void MergeShouldHandleAllEmptyIterators()
        {
            ScoreEntityIterator one   = IteratorOf(EmptyEntries());
            ScoreEntityIterator two   = IteratorOf(EmptyEntries());
            ScoreEntityIterator three = IteratorOf(EmptyEntries());

            ScoreEntityIterator concat = ScoreEntityIterator.MergeIterators(Arrays.asList(one, two, three));

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(concat.HasNext());
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mergeShouldHandleEmptyIterators()
        public virtual void MergeShouldHandleEmptyIterators()
        {
            ScoreEntityIterator one   = IteratorOf(EmptyEntries());
            ScoreEntityIterator two   = IteratorOf(new ScoreEntry[] { Entry(1, 5), Entry(2, 4), Entry(3, 3), Entry(4, 2), Entry(5, 1) });
            ScoreEntityIterator three = IteratorOf(EmptyEntries());

            ScoreEntityIterator concat = ScoreEntityIterator.MergeIterators(Arrays.asList(one, two, three));

            for (int i = 1; i <= 5; i++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(concat.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                ScoreEntry entry = concat.Next();
                assertEquals(i, entry.EntityId());
                assertEquals(6 - i, entry.Score(), 0.001);
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(concat.HasNext());
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mergeShouldReturnOrderedResults()
        public virtual void MergeShouldReturnOrderedResults()
        {
            ScoreEntityIterator one   = IteratorOf(new ScoreEntry[] { Entry(3, 10), Entry(10, 3), Entry(12, 1) });
            ScoreEntityIterator two   = IteratorOf(new ScoreEntry[] { Entry(1, 12), Entry(5, 8), Entry(7, 6), Entry(8, 5), Entry(11, 2) });
            ScoreEntityIterator three = IteratorOf(new ScoreEntry[] { Entry(2, 11), Entry(4, 9), Entry(6, 7), Entry(9, 4) });

            ScoreEntityIterator concat = ScoreEntityIterator.MergeIterators(Arrays.asList(one, two, three));

            for (int i = 1; i <= 12; i++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(concat.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                ScoreEntry entry = concat.Next();
                assertEquals(i, entry.EntityId());
                assertEquals(13 - i, entry.Score(), 0.001);
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(concat.HasNext());
        }
예제 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyNodeData(FulltextIndexProvider provider, long thirdNodeid) throws Exception
        private void VerifyNodeData(FulltextIndexProvider provider, long thirdNodeid)
        {
            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction   ktx    = LuceneFulltextTestSupport.KernelTransaction(tx);
                ScoreEntityIterator result = provider.Query(ktx, "fulltext", "value");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(0L, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());

                result = provider.Query(ktx, "fulltext", "villa");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertEquals(thirdNodeid, result.Next().entityId());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());

                result = provider.Query(ktx, "fulltext", "value3");
                PrimitiveLongSet ids = Primitive.longSet();
                ids.Add(0L);
                ids.Add(thirdNodeid);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(ids.Remove(result.Next().entityId()));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(ids.Remove(result.Next().entityId()));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());
                tx.Success();
            }
        }