use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateWhenRemovingLastTokenForNonSchemaIndex.
@Test
void shouldGenerateUpdateWhenRemovingLastTokenForNonSchemaIndex() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(EMPTY).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.remove(ENTITY_ID, NON_SCHEMA_NODE_INDEX, VALUES_123));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportNodesThatAreNotIndexed.
@ParameterizedTest
@EnumSource(IndexSize.class)
void shouldReportNodesThatAreNotIndexed(IndexSize indexSize) throws Exception {
indexSize.createAdditionalData(fixture);
// given
Iterator<IndexDescriptor> indexDescriptorIterator = getValueIndexDescriptors();
while (indexDescriptorIterator.hasNext()) {
IndexDescriptor indexDescriptor = indexDescriptorIterator.next();
IndexAccessor accessor = fixture.indexAccessorLookup().apply(indexDescriptor);
try (IndexUpdater updater = accessor.newUpdater(IndexUpdateMode.ONLINE, NULL)) {
for (long nodeId : indexedNodes) {
EntityUpdates updates = fixture.nodeAsUpdates(nodeId);
for (IndexEntryUpdate<?> update : updates.valueUpdatesForIndexKeys(singletonList(indexDescriptor))) {
updater.process(IndexEntryUpdate.remove(nodeId, indexDescriptor, ((ValueIndexEntryUpdate<?>) update).values()));
}
}
}
}
// when
ConsistencySummaryStatistics stats = check();
// then
// 1 node missing from 1 index + 1 node missing from 2 indexes
on(stats).verify(RecordType.NODE, 3).andThatsAllFolks();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertDynamicChangedProperty.
@Test
void shouldConvertDynamicChangedProperty() {
// GIVEN
int key = 10;
PropertyRecord before = propertyRecord(property(key, longString));
PropertyRecord after = propertyRecord(property(key, longerString));
// WHEN
EntityUpdates update = convert(none, none, change(before, after));
// THEN
EntityUpdates expected = EntityUpdates.forEntity(0, false).changed(key, longString, longerString).build();
assertEquals(expected, update);
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldTreatPropertyThatMovedToAnotherRecordAsChange.
@Test
void shouldTreatPropertyThatMovedToAnotherRecordAsChange() {
// GIVEN
int key = 12;
Value oldValue = Values.of("value1");
Value newValue = Values.of("value two");
Command.PropertyCommand movedFrom = change(propertyRecord(property(key, oldValue)), propertyRecord());
Command.PropertyCommand movedTo = change(propertyRecord(), propertyRecord(property(key, newValue)));
// WHEN
EntityUpdates update = convert(none, none, movedFrom, movedTo);
// THEN
EntityUpdates expected = EntityUpdates.forEntity(0, false).changed(key, oldValue, newValue).build();
assertEquals(expected, update);
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertInlinedRemovedProperty.
@Test
void shouldConvertInlinedRemovedProperty() {
// GIVEN
int key = 10;
Value value = Values.of(12341);
PropertyRecord before = propertyRecord(property(key, value));
PropertyRecord after = propertyRecord();
// WHEN
EntityUpdates update = convert(none, none, change(before, after));
// THEN
EntityUpdates expected = EntityUpdates.forEntity(0, false).removed(key, value).build();
assertEquals(expected, update);
}
Aggregations