//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRelationshipsByTypeAndDirection()
        public virtual void ShouldGetRelationshipsByTypeAndDirection()
        {
            RelationshipChangesForNode changes = new RelationshipChangesForNode(RelationshipChangesForNode.DiffStrategy.Add);

            const int type      = 2;
            const int decoyType = 666;

            changes.AddRelationship(1, type, INCOMING);
            changes.AddRelationship(2, type, OUTGOING);
            changes.AddRelationship(3, type, OUTGOING);
            changes.AddRelationship(4, type, LOOP);
            changes.AddRelationship(5, type, LOOP);
            changes.AddRelationship(6, type, LOOP);

            changes.AddRelationship(10, decoyType, INCOMING);
            changes.AddRelationship(11, decoyType, OUTGOING);
            changes.AddRelationship(12, decoyType, LOOP);

            LongIterator rawIncoming = changes.GetRelationships(RelationshipDirection.INCOMING, type);

            assertThat(PrimitiveLongCollections.asArray(rawIncoming), Ids(1));

            LongIterator rawOutgoing = changes.GetRelationships(RelationshipDirection.OUTGOING, type);

            assertThat(PrimitiveLongCollections.asArray(rawOutgoing), Ids(2, 3));

            LongIterator rawLoops = changes.GetRelationships(RelationshipDirection.LOOP, type);

            assertThat(PrimitiveLongCollections.asArray(rawLoops), Ids(4, 5, 6));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {7, 11, 14, 20, 35, 58}) void partitionedIndexPopulation(int affectedNodes) throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void PartitionedIndexPopulation(int affectedNodes)
        {
            File rootFolder = new File(_testDir.directory("partitionIndex" + affectedNodes), "uniqueIndex" + affectedNodes);

            using (SchemaIndex uniqueIndex = LuceneSchemaIndexBuilder.create(_descriptor, Config.defaults()).withFileSystem(_fileSystem).withIndexRootFolder(rootFolder).build())
            {
                uniqueIndex.open();

                // index is empty and not yet exist
                assertEquals(0, uniqueIndex.allDocumentsReader().maxCount());
                assertFalse(uniqueIndex.exists());

                using (LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor(uniqueIndex, _descriptor))
                {
                    GenerateUpdates(indexAccessor, affectedNodes);
                    indexAccessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);

                    // now index is online and should contain updates data
                    assertTrue(uniqueIndex.Online);

                    using (IndexReader indexReader = indexAccessor.NewReader(), IndexSampler indexSampler = indexReader.CreateSampler())
                    {
                        long[] nodes = PrimitiveLongCollections.asArray(indexReader.Query(IndexQuery.exists(1)));
                        assertEquals(affectedNodes, nodes.Length);

                        IndexSample sample = indexSampler.SampleIndex();
                        assertEquals(affectedNodes, sample.IndexSize());
                        assertEquals(affectedNodes, sample.UniqueValues());
                        assertEquals(affectedNodes, sample.SampleSize());
                    }
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRelationships()
        public virtual void ShouldGetRelationships()
        {
            RelationshipChangesForNode changes = new RelationshipChangesForNode(RelationshipChangesForNode.DiffStrategy.Add);

            const int type = 2;

            changes.AddRelationship(1, type, INCOMING);
            changes.AddRelationship(2, type, OUTGOING);
            changes.AddRelationship(3, type, OUTGOING);
            changes.AddRelationship(4, type, LOOP);
            changes.AddRelationship(5, type, LOOP);
            changes.AddRelationship(6, type, LOOP);

            LongIterator rawRelationships = changes.Relationships;

            assertThat(PrimitiveLongCollections.asArray(rawRelationships), Ids(1, 2, 3, 4, 5, 6));
        }