Search in sources :

Example 26 with LongList

use of org.eclipse.collections.api.list.primitive.LongList in project neo4j by neo4j.

the class TokenIndexAccessorTest method readerShouldHandleNestedQueries.

@ParameterizedTest
@MethodSource("orderCombinations")
void readerShouldHandleNestedQueries(IndexOrder outerOrder, IndexOrder innerOrder) throws Exception {
    int outerTokenId = 1;
    int innerTokenId = 2;
    long[] outerIds = new long[] { 1, 2, 3, 64, 65, 1000, 2001 };
    long[] innerIds = new long[] { 1, 2, 4, 64, 66, 1000, 2000 };
    LongList outerExpectedIds = LongLists.immutable.of(outerIds);
    LongList innerExpectedIds = LongLists.immutable.of(innerIds);
    addToIndex(outerTokenId, outerIds);
    addToIndex(innerTokenId, innerIds);
    try (var reader = accessor.newTokenReader()) {
        assertReaderFindsExpected(reader, outerOrder, outerTokenId, outerExpectedIds, indexReader -> assertReaderFindsExpected(indexReader, innerOrder, innerTokenId, innerExpectedIds, ThrowingConsumer.noop()));
    }
}
Also used : MutableLongList(org.eclipse.collections.api.list.primitive.MutableLongList) LongList(org.eclipse.collections.api.list.primitive.LongList) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 27 with LongList

use of org.eclipse.collections.api.list.primitive.LongList in project neo4j by neo4j.

the class TokenIndexAccessorTest method readerShouldFindManyWithNoOtherTokens.

@ParameterizedTest
@EnumSource(IndexOrder.class)
void readerShouldFindManyWithNoOtherTokens(IndexOrder indexOrder) throws Exception {
    // Given
    int tokenId = 1;
    long[] entityIds = new long[] { 1, 2, 3, 64, 65, 1000, 2000 };
    addToIndex(tokenId, entityIds);
    LongList expectedIds = LongLists.immutable.of(entityIds);
    // When
    assertReaderFindsExpected(indexOrder, tokenId, expectedIds);
}
Also used : MutableLongList(org.eclipse.collections.api.list.primitive.MutableLongList) LongList(org.eclipse.collections.api.list.primitive.LongList) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 28 with LongList

use of org.eclipse.collections.api.list.primitive.LongList in project neo4j by neo4j.

the class TokenIndexAccessorTest method readerShouldFindSingleWithNoOtherTokens.

@Test
void readerShouldFindSingleWithNoOtherTokens() throws Exception {
    // Given
    int tokenId = 1;
    long entityId = 1;
    addToIndex(tokenId, entityId);
    LongList expectedIds = LongLists.immutable.of(entityId);
    // When
    assertReaderFindsExpected(tokenId, expectedIds);
}
Also used : MutableLongList(org.eclipse.collections.api.list.primitive.MutableLongList) LongList(org.eclipse.collections.api.list.primitive.LongList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 29 with LongList

use of org.eclipse.collections.api.list.primitive.LongList in project neo4j by neo4j.

the class TokenIndexAccessorTest method readerShouldFindSingleWithOtherTokens.

@Test
void readerShouldFindSingleWithOtherTokens() throws Exception {
    // Given
    int tokenId = 1;
    long entityId = 1;
    addToIndex(tokenId, entityId);
    addToIndex(2, 2);
    LongList expectedIds = LongLists.immutable.of(entityId);
    // When
    assertReaderFindsExpected(tokenId, expectedIds);
}
Also used : MutableLongList(org.eclipse.collections.api.list.primitive.MutableLongList) LongList(org.eclipse.collections.api.list.primitive.LongList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

LongList (org.eclipse.collections.api.list.primitive.LongList)29 Test (org.junit.jupiter.api.Test)23 ExecutorService (java.util.concurrent.ExecutorService)19 CursorFactory (org.neo4j.internal.kernel.api.CursorFactory)19 MutableLongList (org.eclipse.collections.api.list.primitive.MutableLongList)18 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)12 ArrayList (java.util.ArrayList)11 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)11 Future (java.util.concurrent.Future)9 Read (org.neo4j.internal.kernel.api.Read)8 Write (org.neo4j.internal.kernel.api.Write)8 NodeCursor (org.neo4j.internal.kernel.api.NodeCursor)6 RelationshipScanCursor (org.neo4j.internal.kernel.api.RelationshipScanCursor)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 NodeLabelIndexCursor (org.neo4j.internal.kernel.api.NodeLabelIndexCursor)5 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)3 MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)3 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 List (java.util.List)2