use of org.eclipse.collections.api.set.primitive.MutableLongSet in project neo4j by neo4j.
the class IndexingStringQueryAcceptanceTest method shouldIncludeEntitiesCreatedInSameTxInIndexSeek.
@ParameterizedTest(name = "shouldIncludeEntitiesCreatedInSameTxInIndexSeek using {0} match with {1} index on {2}")
@MethodSource("data")
void shouldIncludeEntitiesCreatedInSameTxInIndexSeek(DataSet dataSet, IndexingMode withIndex, EntityControl entityControl) {
// GIVEN
createIndex(entityControl, withIndex);
createEntities(entityControl, db, tokenName, dataSet.nonMatching[0], dataSet.nonMatching[1]);
MutableLongSet expected = createEntities(entityControl, db, tokenName, dataSet.matching[0], dataSet.matching[1]);
// WHEN
LongSet found;
try (Transaction tx = db.beginTx()) {
expected.add(entityControl.createEntity(tx, tokenName, map(KEY, dataSet.matching[2])));
entityControl.createEntity(tx, tokenName, map(KEY, dataSet.nonMatching[2]));
found = entityControl.findEntities(tx, tokenName, KEY, dataSet.template, dataSet.searchMode);
}
// THEN
assertThat(found).isEqualTo(expected);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project neo4j by neo4j.
the class IndexingStringQueryAcceptanceTest method shouldConsiderEntitiesChangedInSameTxInIndexSeek.
@ParameterizedTest(name = "shouldConsiderEntitiesChangedInSameTxInIndexSeek using {0} match with {1} index on {2}")
@MethodSource("data")
void shouldConsiderEntitiesChangedInSameTxInIndexSeek(DataSet dataSet, IndexingMode withIndex, EntityControl entityControl) {
// GIVEN
createIndex(entityControl, withIndex);
createEntities(entityControl, db, tokenName, dataSet.nonMatching[0]);
LongSet toChangeToMatch = createEntities(entityControl, db, tokenName, dataSet.nonMatching[1]);
MutableLongSet toChangeToNotMatch = createEntities(entityControl, db, tokenName, dataSet.matching[0]);
MutableLongSet expected = createEntities(entityControl, db, tokenName, dataSet.matching[1]);
// WHEN
LongSet found;
try (Transaction tx = db.beginTx()) {
toChangeToMatch.each(id -> {
entityControl.setProperty(tx, id, KEY, dataSet.matching[2]);
expected.add(id);
});
toChangeToNotMatch.each(id -> {
entityControl.setProperty(tx, id, KEY, dataSet.nonMatching[2]);
expected.remove(id);
});
found = entityControl.findEntities(tx, tokenName, KEY, dataSet.template, dataSet.searchMode);
}
// THEN
assertThat(found).isEqualTo(expected);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project neo4j by neo4j.
the class IndexingCompositeQueryAcceptanceTest method shouldConsiderEntitiesChangedInSameTxInIndexSeek.
@ParameterizedTest(name = "shouldConsiderEntitiesChangedInSameTxInIndexSeek using {0} with {1} index for {2}")
@MethodSource("data")
public void shouldConsiderEntitiesChangedInSameTxInIndexSeek(DataSet dataSet, IndexingMode withIndex, EntityControl entityControl) {
createIndex(withIndex, dataSet.keys, entityControl);
// GIVEN
createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.nonMatching[0]);
LongSet toChangeToMatch = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.nonMatching[1]);
LongSet toChangeToNotMatch = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.values);
MutableLongSet expected = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.values);
// WHEN
LongSet found;
try (Transaction tx = db.beginTx()) {
LongIterator toMatching = toChangeToMatch.longIterator();
while (toMatching.hasNext()) {
long id = toMatching.next();
entityControl.setProperties(tx, id, dataSet.keys, dataSet.values);
expected.add(id);
}
LongIterator toNotMatching = toChangeToNotMatch.longIterator();
while (toNotMatching.hasNext()) {
long id = toNotMatching.next();
entityControl.setProperties(tx, id, dataSet.keys, dataSet.nonMatching[2]);
expected.remove(id);
}
found = dataSet.indexSeek.findEntities(tx, dataSet.keys, dataSet.values, entityControl);
}
// THEN
assertThat(found).isEqualTo(expected);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project neo4j by neo4j.
the class IndexingCompositeQueryAcceptanceTest method shouldIncludeEntitiesCreatedInSameTxInIndexSeek.
@ParameterizedTest(name = "shouldIncludeEntitiesCreatedInSameTxInIndexSeek using {0} with {1} index for {2}")
@MethodSource("data")
public void shouldIncludeEntitiesCreatedInSameTxInIndexSeek(DataSet dataSet, IndexingMode withIndex, EntityControl entityControl) {
createIndex(withIndex, dataSet.keys, entityControl);
// GIVEN
createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.nonMatching[0], dataSet.nonMatching[1]);
MutableLongSet expected = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.values);
// WHEN
LongSet found;
try (Transaction tx = db.beginTx()) {
expected.add(entityControl.createEntity(tx, TOKEN_NAME, propertyMap(dataSet.keys, dataSet.values)));
entityControl.createEntity(tx, TOKEN_NAME, propertyMap(dataSet.keys, dataSet.nonMatching[2]));
found = dataSet.indexSeek.findEntities(tx, dataSet.keys, dataSet.values, entityControl);
}
// THEN
assertThat(found).isEqualTo(expected);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project neo4j by neo4j.
the class IndexingCompositeQueryAcceptanceTest method mapToIds.
private static LongSet mapToIds(ResourceIterator<? extends Entity> nodes) {
MutableLongSet found = new LongHashSet();
nodes.stream().mapToLong(Entity::getId).forEach(found::add);
return found;
}
Aggregations