use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class IndexTxStateLookupTest method shouldRemoveDeletedNodeCreatedInSameTransactionFromIndexTxStateEvenWithMultipleProperties.
@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
void shouldRemoveDeletedNodeCreatedInSameTransactionFromIndexTxStateEvenWithMultipleProperties(Object store, Object lookup) {
init(store, lookup);
try (Transaction tx = db.beginTx()) {
// given
Label label = label("Node");
String key = "prop";
String key2 = "prop2";
Node node = tx.createNode(label);
node.setProperty(key, this.store);
node.setProperty(key2, this.store);
assertTrue(tx.findNodes(label, key, this.lookup).hasNext());
// when
node.delete();
// then
assertFalse(tx.findNodes(label, key, this.lookup).hasNext());
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class IndexTxStateLookupTest method shouldRemoveDeletedRelationshipCreatedInSameTransactionFromIndexTxStateEvenWithMultipleProperties.
@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
void shouldRemoveDeletedRelationshipCreatedInSameTransactionFromIndexTxStateEvenWithMultipleProperties(Object store, Object lookup) {
init(store, lookup);
try (Transaction tx = db.beginTx()) {
// given
RelationshipType type = RelationshipType.withName("Rel");
String key = "prop";
String key2 = "prop2";
Relationship relationship = tx.createNode().createRelationshipTo(tx.createNode(), type);
relationship.setProperty(key, this.store);
relationship.setProperty(key2, this.store);
assertTrue(tx.findRelationships(type, key, this.lookup).hasNext());
// when
relationship.delete();
// then
assertFalse(tx.findRelationships(type, key, this.lookup).hasNext());
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class IndexTxStateLookupTest method lookupWithoutTransaction.
@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
public void lookupWithoutTransaction(Object store, Object lookup) {
init(store, lookup);
// when
Node node;
try (Transaction tx = db.beginTx()) {
(node = tx.createNode(label("Node"))).setProperty("prop", this.store);
tx.commit();
}
// then
try (Transaction tx = db.beginTx()) {
assertEquals(1, count(tx.findNodes(label("Node"), "prop", this.lookup)));
tx.commit();
}
deleteNode(node);
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class IndexTxStateLookupTest method lookupWithinTransaction.
@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
public void lookupWithinTransaction(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
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class FulltextIndexSkipAndLimitTest method queryEntitiesMustApplySkip.
@MethodSource("entityTypeProvider")
@ParameterizedTest
void queryEntitiesMustApplySkip(EntityUtil entityUtil) {
setUp(entityUtil);
try (Transaction tx = db.beginTx();
ResourceIterator<Entity> iterator = entityUtil.queryIndexWithOptions(tx, "zebra", "{skip:1}")) {
assertThat(iterator.next().getId()).isEqualTo(middleEntity);
assertThat(iterator.next().getId()).isEqualTo(bottomEntity);
assertFalse(iterator.hasNext());
tx.commit();
}
}
Aggregations