Search in sources :

Example 71 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.

the class MultipleOpenCursorsTest method multipleIteratorsNestedInnerNewExact.

@ParameterizedTest
@MethodSource(value = "params")
void multipleIteratorsNestedInnerNewExact(IndexCoordinator indexCoordinator) throws Exception {
    indexCoordinator.init(db);
    try (Transaction tx = db.beginTx()) {
        // when
        KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
        try (NodeValueIndexCursor cursor1 = indexCoordinator.queryExact(ktx)) {
            List<Long> actual1 = new ArrayList<>();
            while (cursor1.next()) {
                actual1.add(cursor1.nodeReference());
                try (NodeValueIndexCursor cursor2 = indexCoordinator.queryExact(ktx)) {
                    List<Long> actual2 = asList(cursor2);
                    indexCoordinator.assertExactResult(actual2);
                }
            }
            // then
            indexCoordinator.assertExactResult(actual1);
        }
        tx.commit();
    }
}
Also used : KernelTransaction(org.neo4j.kernel.api.KernelTransaction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) NodeValueIndexCursor(org.neo4j.internal.kernel.api.NodeValueIndexCursor) ArrayList(java.util.ArrayList) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 72 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.

the class MultipleOpenCursorsTest method multipleIteratorsNestedInnerNewRange.

@ParameterizedTest
@MethodSource(value = "params")
void multipleIteratorsNestedInnerNewRange(IndexCoordinator indexCoordinator) throws Exception {
    assumeTrue(indexCoordinator.supportRangeQuery());
    indexCoordinator.init(db);
    try (Transaction tx = db.beginTx()) {
        // when
        KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
        try (NodeValueIndexCursor cursor1 = indexCoordinator.queryRange(ktx)) {
            List<Long> actual1 = new ArrayList<>();
            while (cursor1.next()) {
                actual1.add(cursor1.nodeReference());
                try (NodeValueIndexCursor cursor2 = indexCoordinator.queryRange(ktx)) {
                    List<Long> actual2 = asList(cursor2);
                    indexCoordinator.assertRangeResult(actual2);
                }
            }
            // then
            indexCoordinator.assertRangeResult(actual1);
        }
        tx.commit();
    }
}
Also used : KernelTransaction(org.neo4j.kernel.api.KernelTransaction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) NodeValueIndexCursor(org.neo4j.internal.kernel.api.NodeValueIndexCursor) ArrayList(java.util.ArrayList) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 73 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.

the class MultipleOpenCursorsTest method multipleCursorsNotNestedExists.

@ParameterizedTest
@MethodSource(value = "params")
void multipleCursorsNotNestedExists(IndexCoordinator indexCoordinator) throws Exception {
    indexCoordinator.init(db);
    try (Transaction tx = db.beginTx()) {
        KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
        // when
        try (NodeValueIndexCursor cursor1 = indexCoordinator.queryExists(ktx);
            NodeValueIndexCursor cursor2 = indexCoordinator.queryExists(ktx)) {
            List<Long> actual1 = asList(cursor1);
            List<Long> actual2 = asList(cursor2);
            // then
            indexCoordinator.assertExistsResult(actual1);
            indexCoordinator.assertExistsResult(actual2);
        }
        tx.commit();
    }
}
Also used : KernelTransaction(org.neo4j.kernel.api.KernelTransaction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) NodeValueIndexCursor(org.neo4j.internal.kernel.api.NodeValueIndexCursor) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 74 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.

the class MultipleOpenCursorsTest method multipleCursorsNotNestedExact.

@ParameterizedTest
@MethodSource(value = "params")
void multipleCursorsNotNestedExact(IndexCoordinator indexCoordinator) throws Exception {
    indexCoordinator.init(db);
    try (Transaction tx = db.beginTx()) {
        // when
        KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
        try (NodeValueIndexCursor cursor1 = indexCoordinator.queryExact(ktx);
            NodeValueIndexCursor cursor2 = indexCoordinator.queryExact(ktx)) {
            List<Long> actual1 = asList(cursor1);
            List<Long> actual2 = asList(cursor2);
            // then
            indexCoordinator.assertExactResult(actual1);
            indexCoordinator.assertExactResult(actual2);
        }
        tx.commit();
    }
}
Also used : KernelTransaction(org.neo4j.kernel.api.KernelTransaction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) NodeValueIndexCursor(org.neo4j.internal.kernel.api.NodeValueIndexCursor) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 75 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.

the class IndexTxStateLookupTest method lookupWithinTransactionWithCacheEviction.

@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
public void lookupWithinTransactionWithCacheEviction(Object store, Object lookup) {
    init(store, lookup);
    try (Transaction tx = db.beginTx()) {
        // when
        tx.createNode(label("Node")).setProperty("prop", this.store);
        // then
        assertEquals(1, count(tx.findNodes(label("Node"), "prop", this.lookup)));
    // no need to actually commit this node
    }
}
Also used : Transaction(org.neo4j.graphdb.Transaction) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

MethodSource (org.junit.jupiter.params.provider.MethodSource)1199 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1184 Transaction (org.neo4j.graphdb.Transaction)103 Stream (java.util.stream.Stream)70 Test (org.junit.jupiter.api.Test)67 ArrayList (java.util.ArrayList)63 InterruptAfter (io.aeron.test.InterruptAfter)60 List (java.util.List)60 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)58 TimeUnit (java.util.concurrent.TimeUnit)54 IOException (java.io.IOException)52 CountDownLatch (java.util.concurrent.CountDownLatch)52 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)52 lombok.val (lombok.val)52 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)51 Arguments (org.junit.jupiter.params.provider.Arguments)47 AfterEach (org.junit.jupiter.api.AfterEach)46 SSLEngine (javax.net.ssl.SSLEngine)44 AtomicReference (java.util.concurrent.atomic.AtomicReference)43 Path (java.nio.file.Path)42