use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForLabelAdditionWithExistingProperty.
@Test
void shouldGenerateUpdateForLabelAdditionWithExistingProperty() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(EMPTY).withTokensAfter(TOKEN).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(NODE_INDEXES, propertyLoader(PROPERTY_1), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.add(ENTITY_ID, NODE_INDEX_1, PROPERTY_1.value()));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldNotLoadPropertyForNoLabelsAndButPropertyAddition.
@Test
void shouldNotLoadPropertyForNoLabelsAndButPropertyAddition() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(EMPTY).added(PROPERTY_1.propertyKeyId(), PROPERTY_1.value()).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NODE_INDEX_1), assertNoLoading(), EntityType.NODE, NULL, INSTANCE)).isEmpty();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdatesForLabelRemovalWithExistingProperties.
@Test
void shouldGenerateUpdatesForLabelRemovalWithExistingProperties() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(EMPTY).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(NODE_INDEXES, propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.remove(ENTITY_ID, NODE_INDEX_1, PROPERTY_1.value()), IndexEntryUpdate.remove(ENTITY_ID, NODE_INDEX_2, PROPERTY_2.value()), IndexEntryUpdate.remove(ENTITY_ID, NODE_INDEX_3, PROPERTY_3.value()), IndexEntryUpdate.remove(ENTITY_ID, NODE_INDEX_123, VALUES_123));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldNotGenerateUpdateWhenAddingAnotherTokenForNonSchemaIndex.
@Test
void shouldNotGenerateUpdateWhenAddingAnotherTokenForNonSchemaIndex() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(ALL_TOKENS).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).isEmpty();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForPartialNonSchemaIndexUpdate.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForPartialNonSchemaIndexUpdate(Entity entity) {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).added(PROPERTY_KEY_ID_1, Values.of("Neo")).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.nonSchemaIndex()), propertyLoader(), entity.type(), NULL, INSTANCE)).contains(IndexEntryUpdate.add(ENTITY_ID, entity.nonSchemaIndex(), PROPERTY_1.value(), null, null));
}
Aggregations