Search in sources :

Example 91 with MethodSource

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

the class FulltextProceduresTest method queryResultsMustIncludeUpdatedValueOfChangedProperties.

@MethodSource("entityTypeProvider")
@ParameterizedTest
void queryResultsMustIncludeUpdatedValueOfChangedProperties(EntityUtil entityUtil) {
    createIndexAndWait(entityUtil);
    long entityId;
    try (Transaction tx = db.beginTx()) {
        entityId = entityUtil.createEntityWithProperty(tx, "primo");
        tx.commit();
    }
    entityUtil.assertQueryFindsIdsInOrder(db, "primo", entityId);
    try (Transaction tx = db.beginTx()) {
        entityUtil.getEntity(tx, entityId).setProperty(PROP, "secundo");
        tx.commit();
    }
    entityUtil.assertQueryFindsIdsInOrder(db, "primo");
    entityUtil.assertQueryFindsIdsInOrder(db, "secundo", entityId);
}
Also used : Transaction(org.neo4j.graphdb.Transaction) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 92 with MethodSource

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

the class FulltextProceduresTest method mustSupportWildcardEndsLikeStartsWith.

@MethodSource("entityTypeProvider")
@ParameterizedTest
void mustSupportWildcardEndsLikeStartsWith(EntityUtil entityUtil) {
    createIndexAndWait(entityUtil);
    LongHashSet ids = new LongHashSet();
    try (Transaction tx = db.beginTx()) {
        ids.add(entityUtil.createEntityWithProperty(tx, "abcdef"));
        ids.add(entityUtil.createEntityWithProperty(tx, "abcxyz"));
        tx.commit();
    }
    entityUtil.assertQueryFindsIds(db, "abc*", ids);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) Transaction(org.neo4j.graphdb.Transaction) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 93 with MethodSource

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

the class FulltextProceduresTest method queryResultsMustBeOrderedByScore.

@MethodSource("entityTypeProvider")
@ParameterizedTest
void queryResultsMustBeOrderedByScore(EntityUtil entityUtil) {
    createIndexAndWait(entityUtil);
    long firstId;
    long secondId;
    long thirdId;
    try (Transaction tx = db.beginTx()) {
        firstId = entityUtil.createEntityWithProperty(tx, "dude sweet dude sweet");
        tx.commit();
    }
    try (Transaction tx = db.beginTx()) {
        secondId = entityUtil.createEntityWithProperty(tx, "dude sweet");
        tx.commit();
    }
    try (Transaction tx = db.beginTx()) {
        thirdId = entityUtil.createEntityWithProperty(tx, "dude sweet dude dude dude sweet");
        tx.commit();
    }
    entityUtil.assertQueryFindsIdsInOrder(db, "dude", thirdId, firstId, secondId);
}
Also used : Transaction(org.neo4j.graphdb.Transaction) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 94 with MethodSource

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

the class FulltextProceduresTest method creatingAndDroppingIndexesInSameTransactionMustNotThrow.

@MethodSource("entityTypeProvider")
@ParameterizedTest
void creatingAndDroppingIndexesInSameTransactionMustNotThrow(EntityUtil entityUtil) {
    try (Transaction tx = db.beginTx()) {
        entityUtil.createIndex(tx);
        entityUtil.dropIndex(tx);
        tx.commit();
    }
    awaitIndexesOnline();
    try (Transaction tx = db.beginTx()) {
        var result = tx.execute(SHOW_FULLTEXT_INDEXES);
        assertThat(result.hasNext()).isFalse().as("Fulltext indexes should not be created");
        tx.commit();
    }
}
Also used : Transaction(org.neo4j.graphdb.Transaction) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 95 with MethodSource

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

the class FulltextProceduresTest method queryResultsMustNotIncludeEntitiesWithRemovedIndexedProperties.

@MethodSource("entityTypeProvider")
@ParameterizedTest
void queryResultsMustNotIncludeEntitiesWithRemovedIndexedProperties(EntityUtil entityUtil) {
    createIndexAndWait(entityUtil);
    long entityId;
    try (Transaction tx = db.beginTx()) {
        entityId = entityUtil.createEntityWithProperty(tx, "value");
        tx.commit();
    }
    entityUtil.assertQueryFindsIdsInOrder(db, "value", entityId);
    try (Transaction tx = db.beginTx()) {
        entityUtil.getEntity(tx, entityId).removeProperty(PROP);
        tx.commit();
    }
    entityUtil.assertQueryFindsIdsInOrder(db, "value");
}
Also used : Transaction(org.neo4j.graphdb.Transaction) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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