use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityTokenUpdatesTest method shouldNotGenerateUpdatesForEmptyEntityUpdates.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldNotGenerateUpdatesForEmptyEntityUpdates(Entity entity) {
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).build();
assertThat(updates.tokenUpdateForIndexKey(entity.getTokenIndex(), -1)).isEmpty();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityTokenUpdatesTest method shouldGenerateUpdateForChangedTokens.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForChangedTokens(Entity entity) {
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN_1_ID).withTokensAfter(TOKEN_1_ID, TOKEN_2_ID).build();
assertThat(updates.tokenUpdateForIndexKey(entity.getTokenIndex(), -1)).contains(IndexEntryUpdate.change(ENTITY_ID, entity.getTokenIndex(), new long[] { TOKEN_1_ID }, new long[] { TOKEN_1_ID, TOKEN_2_ID }));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertInlinedChangedProperty.
@Test
void shouldConvertInlinedChangedProperty() {
// GIVEN
int key = 10;
Value valueBefore = Values.of(12341);
Value valueAfter = Values.of(738);
PropertyRecord before = propertyRecord(property(key, valueBefore));
PropertyRecord after = propertyRecord(property(key, valueAfter));
// WHEN
EntityUpdates update = convert(none, none, change(before, after));
// THEN
EntityUpdates expected = EntityUpdates.forEntity(0, false).changed(key, valueBefore, valueAfter).build();
assertEquals(expected, update);
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertDynamicInlinedRemovedProperty.
@Test
void shouldConvertDynamicInlinedRemovedProperty() {
// GIVEN
int key = 10;
PropertyRecord before = propertyRecord(property(key, longString));
PropertyRecord after = propertyRecord();
// WHEN
EntityUpdates update = convert(none, none, change(before, after));
// THEN
EntityUpdates expected = EntityUpdates.forEntity(0, false).removed(key, longString).build();
assertEquals(expected, update);
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method applyConcurrentAddsToPopulatedIndex.
@ParameterizedTest
@MethodSource("parameters")
void applyConcurrentAddsToPopulatedIndex(GraphDatabaseSettings.SchemaIndex schemaIndex) throws Throwable {
List<EntityUpdates> updates = new ArrayList<>(2);
updates.add(EntityUpdates.forEntity(otherNodes[0].getId(), false).withTokens(id(COUNTRY_LABEL)).added(propertyId, Values.of("Denmark")).build());
updates.add(EntityUpdates.forEntity(otherNodes[1].getId(), false).withTokens(id(CAR_LABEL)).added(propertyId, Values.of("BMW")).build());
launchCustomIndexPopulation(schemaIndex, labelsNameIdMap, propertyId, new UpdateGenerator(updates));
waitAndActivateIndexes(labelsNameIdMap, propertyId);
try (Transaction tx = db.beginTx()) {
Integer countryLabelId = labelsNameIdMap.get(COUNTRY_LABEL);
Integer carLabelId = labelsNameIdMap.get(CAR_LABEL);
try (var indexReader = getIndexReader(propertyId, countryLabelId)) {
assertThat(indexReader.countIndexedEntities(otherNodes[0].getId(), NULL, new int[] { propertyId }, Values.of("Denmark"))).as("Should be added by concurrent add.").isEqualTo(1);
}
try (var indexReader = getIndexReader(propertyId, carLabelId)) {
assertThat(indexReader.countIndexedEntities(otherNodes[1].getId(), NULL, new int[] { propertyId }, Values.of("BMW"))).as("Should be added by concurrent add.").isEqualTo(1);
}
}
}
Aggregations