use of org.neo4j.internal.helpers.collection.Pair in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringRangeSearchWithChangedEntityInTxState.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringRangeSearchWithChangedEntityInTxState(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
long entityToChange;
try (KernelTransaction tx = beginTransaction()) {
entityToChange = entityWithPropId(tx, "banana");
entityWithPropId(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "cherry"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
TextValue newProperty = stringValue("kiwi");
setProperty(tx, entityToChange, newProperty);
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "berry", PropertyIndexQuery.range(prop, "b", true, "d", false));
}
}
use of org.neo4j.internal.helpers.collection.Pair in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformScan.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformScan(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
long entityToDelete;
long entityToChange;
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "suff1"));
expected.add(entityWithProp(tx, "supp"));
entityToDelete = entityWithPropId(tx, "supp");
entityToChange = entityWithPropId(tx, "supper");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "suff2"));
deleteEntity(tx, entityToDelete);
removeProperty(tx, entityToChange);
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
assertEntityAndValueForScan(expected, tx, index, needsValues, "noff");
}
}
use of org.neo4j.internal.helpers.collection.Pair in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringRangeSearchWithDeletedEntityInTxState.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringRangeSearchWithDeletedEntityInTxState(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
long entityToChange;
try (KernelTransaction tx = beginTransaction()) {
entityToChange = entityWithPropId(tx, "banana");
entityWithPropId(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
expected.add(entityWithProp(tx, "cherry"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
deleteEntity(tx, entityToChange);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "berry", PropertyIndexQuery.range(prop, "b", true, "d", false));
}
}
use of org.neo4j.internal.helpers.collection.Pair in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringRangeSearch.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringRangeSearch(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "banana"));
entityWithProp(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
expected.add(entityWithProp(tx, "cherry"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "berry", PropertyIndexQuery.range(prop, "b", true, "d", false));
}
}
Aggregations